Disarium number Solved program
Disarium number Solved program: solved Java program for ICSE Class 10 Computer Applications with complete BlueJ code, explanation and sample output.
(Disarium number & reverse a number)
Design a menu driven program, that accepts an integer and displays the following menu : Displays the reverse of the number Displays whether the number is a Disarium number or not(Disarium number is a number whose digits raised to the power of their unit places sum is equal to the number. For example 135=11+32+53=1+9+125=135) exit
import java.util.*;
class Q1
{
public static void main()
{
System.out.println("Enter your choice");
Scanner s=new Scanner(System.in);
System.out.println("1:- reverse a number\n2:-checking the number disarium or not\n3:-exit");
int c=s.nextInt();
switch(c)
{
case 1:
System.out.println("Enter the number");
int n=s.nextInt();
int rev=0;
while(n!=0)
{
int rem=n%10;
rev=(rev*10)+rem;
n/=10;
}
System.out.println("Reversed number is:"+rev);
break;
case 2:
System.out.println("Enter a number");
int num=s.nextInt();
int a=num;
String nu=String.valueOf(num);
int i=nu.length();
int sum=0;
while(num!=0)
{
int rem=num%10;
sum+=(Math.pow(rem,i));
i--;
num/=10;
}
if(a==sum)
System.out.println("It is a Disarium number");
else
System.out.println("it is not a Disarium number");
break;
case 3:
System.exit(0);
break;
default:
System.out.println("Invalid number");
}
}
}Related Posts
Continue learning with these related articles

String Methods in Java for ICSE Class 10: 25 Output Questions with Answers
ICSE Class 10 Computer Applications practice on String class methods: length, charAt, indexOf, lastIndexOf, substring, replace, trim, compareTo, equals and more, with 25 board-style output questions and step-by-step answers.

Special Number Programs in Java for ICSE: Armstrong, Spy, Neon, Disarium, Pronic and More
Every special number asked in ICSE Computer Applications – prime, perfect, Armstrong, palindrome, automorphic, neon, spy, Niven, duck, buzz, Disarium, special and pronic numbers – with definitions, examples and one complete Java program that checks them all.

Math Library Methods in Java for ICSE Class 9 (with Outputs)
ICSE Class 9 Computer Applications notes on the Java Math class: sqrt, cbrt, pow, abs, max, min, ceil, floor, round, rint and random, with return types, tricky negative-number outputs and Java expressions for formulas.