Java Program to Check Armstrong Number

public class JavaEx { public static void main(String[] args) { int num = 370, number, temp, total = 0; number = num; while (number != 0) { temp = number % 10; total = total + temp*temp*temp; number /= 10; } if(total == num) System.out.println(num + ” is an Armstrong number”); else System.out.println(num + ” … Read more

C program to find armstrong number

C Programming Tutorial

What is Armstrong number? Sum of a number’s digits raised to the power total number of digits is armstrong number. Armstrong numbers example: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634 etc Explanation: 3 = 3^1 = 3 153 = 1^3 + 5^3 + 3^3 = 153 Non-Armstrong … Read more