Skip to content

Commit

Permalink
Armstrong Number
Browse files Browse the repository at this point in the history
  • Loading branch information
KeerthanaPravallika authored May 25, 2021
1 parent f5a5afc commit ccb8c76
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Armstrong Number
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdio.h>

int main()
{
int num,i,tmp,d,sumOfCubes=0;
printf("Enter the number : ");
scanf("%d",&num);
tmp = num;
while(num!=0)
{
d = num%10;
sumOfCubes = sumOfCubes + (d*d*d);
num = num/10;
}
if(tmp == sumOfCubes)
printf("It is a Armstrong Number");
else
printf("It is not a Armstrong Number");

return 0;
}

0 comments on commit ccb8c76

Please sign in to comment.