/* A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 33 + 73 + 13 = 371. Some other armstrong numbers are: 0, 1, 153, 370, 407 */
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,digit, n1,sum=0;
clrscr();
printf(“Enter the Any Integer No: “);
scanf(“%d”,&n);
n1=n;
while(n!=0)
{
digit = n%10;
sum=sum+pow(digit,3);
n/=10;
}
if (sum==n1)
printf(“%d number is Armstrong “,n1);
else
printf(“%d number is Not Armstrong “,n1);
getch();
}
Latest posts by Mohit Arora (see all)
- MongoDB Operators Tutorial – What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial – Create Index & MongoDB Index Types - July 6, 2018