C programming code to check whether a number is an Armstrong number or not. An Armstrong number is a number which is equ

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C programming code to check whether a number is an Armstrong number or not. An Armstrong number is a number which is equ

Post by answerhappygod »

C Programming Code To Check Whether A Number Is An Armstrong Number Or Not An Armstrong Number Is A Number Which Is Equ 1
C Programming Code To Check Whether A Number Is An Armstrong Number Or Not An Armstrong Number Is A Number Which Is Equ 1 (38.05 KiB) Viewed 36 times
C programming code to check whether a number is an Armstrong number or not. An Armstrong number is a number which is equal to the sum of digits raise to the power of the total number of digits in the number. Some Armstrong numbers are: 0, 1, 2, 3, 153, 370, 407, 1634, 8208, etc. The algorithm to do this is: First we calculate the number of digits in our program and then compute the sum of individual digits raise to the power number of digits. If this sum equals the input number, then the number is an Armstrong number otherwise not. Examples: 7=7^1 371 = 3^3 +7^3 + 1^3 (27+ 343 +1) 8208 = 8^4 + 2^4 +0^4 + 8^4 (4096 + 16 +0+4096). Sample Input: 371 Sample Output: Total number of digits- 3 3^3=27 7^3= 343 1^3= 1 Sum= 371 ARMSTRONG NUMBER!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply