Skip to content

Commit a078f17

Browse files
Create C Program to check Armstrong Number
1 parent 4a5d272 commit a078f17

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

C Program to check Armstrong Number

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
int n, r, sum=0, temp;
5+
printf("Enter the number: ");
6+
scanf("%d", &n);
7+
temp=n;
8+
while(n>0)
9+
{
10+
r=n%10;
11+
sum=sum+(r*r*r);
12+
n=n/10;
13+
}
14+
if(temp==sum)
15+
printf("Armstrong Number");
16+
else
17+
printf("Not Armstrong Number");
18+
}

0 commit comments

Comments
 (0)