**What is Armstrong Number :-
Before going to the Armstrong program , Let's understands what is Armstrong number and the answer is Armstrong Number is a number that is equal to the sum of cubes of it's digits . Now begin the examples of an Armstrong numbers are 0, 153, 370,371,407 etc Let's try to understand why 371 is an Armstrong Number ....
371 = (3*3*3)+(7*7*7)+(1*1*1)
Where :
(3*3*3) = 27
(7*7*7) = 343
(1*1*1) = 1
So :
27+343+1 = 371
Let's see the program :
Main Program :-
#include<stdio.h>
int main()
{
int n,r,sum=0,temp;
printf("enter the number=");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=sum+(r*r*r);
n=n/10;
}
if(temp==sum)
printf("armstrong number ");
else
printf("not armstrong number");
return 0;
}
Input :-
Number is Not Armstrong Number
THANKS FOR VISITING . IF YOU LOVE PROGRAMMING THEN YOU CAN FOLLOW OUR WEBSITE .....
Very short and quick process ❤️
ReplyDelete