Nomor Disarium di Jawa
import java.util.*;
import java.lang.*;
class disarium
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Number: ");
int num = sc.nextInt();
String s = Integer.toString(num);
int l = s.length();
int n = num;
double c = 0;
int last_digit;
while(num > 0)
{
last_digit = num % 10;
c = c + Math.pow(last_digit,l);
num = num / 10;
l--;
}
if(n == c)
{
System.out.println("Disarium Number.");
}
else
{
System.out.println("Not a Disarium Number.");
}
sc.close();
}
}
Poised Parrot