(8727 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".

65 UpvotesUpvote |
10 DownvotesDownvote |

- Redirect port 80 to some another port using iptables on CentOS [226 Views]
- #undef directive in C Language [266 Views]
- Download Machine Learning by Tom Mitchell PDF [756 Views]
- Can MIN() and MAX() functions be used with Date columns in Oracle SQL [261 Views]
- Algorithm to Check whether Input character is a Vowel or Consonant [304 Views]

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