Armstrong Number In C Programming Language

By | May 1, 2020
Armstrong Number In C

Armstrong Number In C is the number that is equal to the sum of all digits to the power of the total number of digits in that number. To understand better check this example given below:

Armstrong Number

Eg:- The Number 153 which is an Armstrong number

Let’s Prove that this number is Armstrong number:

Total digits in number = 3

1^3 = 1*1*1 = 1

5^3 = 5*5*5 = 125

3^3 = 3*3*3 = 9

S0, 153 = (1*1*1)+(5*5*5)+(3*3*3)

153= 1+125+27 , Hence Proved

Armstrong Number In C Program Code:

#include<stdio.h>  
 int main()    
{    
int num,r,sum=0,temp;    
printf("enter the number=");    
scanf("%d",&num);    
temp=num;    
while(num>0)    
{    
r=num%10;    
sum=sum+(r*r*r);    
num=num/10;    
}    
if(temp==sum)    
printf("armstrong  number ");    
else    
printf("not armstrong number");    
return 0;  
}

Still having difficulty to understand, then you can watch this video to understand Armstrong number program:

Try Best Ide For C programming Language: Turbo c++

Sending
User Review
5 (4 votes)

0 thoughts on “Armstrong Number In C Programming Language

  1. Pingback: Armstrong Number In Java Language [Program Code + Example]

Leave a Reply

Your email address will not be published. Required fields are marked *