![]() ![]() ![]() ![]() (actualNumber + " is not an Armstrong Number") (actualNumber + " is an Armstrong Number") Sum = (int) (sum + Math.pow(remainder, n)) ("Enter a number to check for Armstrong") Let’s get into the coding Program 1: Java Program to Check Armstrong Number using While Loop package com.javainterviewpoint Total number digit is 3 and hence the power is 3 Let’s understand with a pretty common example, 153 is an Armstrong number because it satisfies the condition sum of its digits raised to the power of the number of digits of that number should be equal to the actual number 153 = 1 3 + 5 3 + 3 3 A number is said to be an Armstrong Number, whenever it satisfies the below condition. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
May 2023
Categories |