You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 17, 2024. It is now read-only.
Write a program to input a three digit number and print if it is an Armstrong number ( An Armstrong number is a number where the sum of the cubes of its digits equals the number itself. eg: 153, 370, 371, 407).
23/06/23 */
importjava.util.Scanner;
publicclassProgram27 {
publicstaticvoidmain() {
Scannersc = newScanner(System.in);
System.out.print("Enter a three digit number: ");
intn = sc.nextInt();
intu = n % 10;
intt = (n % 100) / 10;
inth = n / 100;
if (u * u * u + t * t * t + h * h * h == n)
System.out.println(n + " is an Armstrong number.");
else
System.out.println(n + " is not an Armstrong number.");