(9390 Views)

An Integer number in which the sum of the cubes of its digits is equal to the number itself is called Armstrong Number. For example, 153 is an Armstrong number since 1**3 + 5**3 + 3**3 = 153.

We first take input from user and store it in variable n. Then we initialize 2 variables temp to n and sum to 0. We calculate the cube of last digit by this expression [(n%10)*(n%10)*(n%10)] and add it to value of sum and also divide n by 10. We repeat the above step until n is greater than or equal to 0. At last, we check whether sum is equal to temp, if yes Print "Number is Armstrong Number" else print "Number is Not Armstrong Number".

67 UpvotesUpvote |
12 DownvotesDownvote |

- Import Data from Spreadsheet to any Database in C# [555 Views]
- Mumbai University Computer Engineering Machine Learning (ML) Semester 8 Important Notes Download [1839 Views]
- Add a column with a default value to a table in Oracle SQL [300 Views]
- Add jar file in your Maven local repository using command line [257 Views]
- Algorithm to find whether a Number is Prime Number or Not [1653 Views]

- Knuth-Morris-Pratt (KMP) Substring Search Algorithm with Java Example [10076 Views]
- Algorithm to find whether number is Armstrong Number or Not [9390 Views]
- How To Win Ludo King Game Every Time [9295 Views]
- error: Multiple commands produce error in Xcode 10 [5637 Views]
- FlowChart and Algorithm to find Whether a Number is Even or Odd [5073 Views]