Opening Hours :7AM to 9PM
Here is some sample Java code that checks if a number is an Armstrong number: public class Main { public static void main(String[] args) { int num = 153; int originalNum = num; int digits = 0; int result = 0; // count the number of digits while (num > 0) { num /= 10; ++digits; } num = originalNum; // calculate the sum of the digits raised to the power of the number of digits while (num > 0) { int digit = num % 10; result += Math.pow(digit, digits); num /= 10; } if (result == originalNum) { System.out.println(originalNum + " is an Armstrong number."); } else { System.out.println(originalNum + " is not an Armstrong number."); } } }This code first counts the number of digits in the number using a while loop. It then calculates the sum of the digits raised to the power of the number of digits using another while loop. Finally, it checks if the sum is equal to the original number. If it is, the number is an Armstrong number.