➽ Program:-
import java.util.*;
import java.io.*;
class Main
{
public static void
main(String args[])
{
int num, sum = 0, remainder, temp;
Scanner
sc = new Scanner(System.in);
System.out.print("Enter a Number: ");
num = sc.nextInt();
temp = num;
while(temp != 0)
{
remainder = temp % 10;
sum += Math.pow(remainder, 3);
temp = temp / 10;
}
if(sum == num)
System.out.print(num + " is an Armstrong No");
else
System.out.print(num + " is not an Armstrong No");
}
}
➽ Output:-
0 Comments
Please do not enter any spam link in the comment section.