Code is copied!
Program To Print Dudeney Number JAVA
Write a Program to print whether the inputted number is Dudeney or not.
[A Dudeney number is a positive integer that is a perfect cube such that the sum of its digits is equal to the cube root of the number. Example : 512]
import java.util.*; class armstrong { public static void main(String args[]) { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int temp =n,sum =0; while (n!=0) { int digit = n % 10; sum = sum + (digit * digit *digit); n=n/10; } if(temp == sum) { System.out.println("yes it is armstrong number"); } else { System.out.println("No it is not armstrong"); } } }