Check Armstrong Number from given Input Integer C program
This program is to check given input integer is Armstrong Number or Not such that sum of qube of each digit is equal to that no.
/* Program to check Armstrong No*/
#include<stdio.h>
#include<math.h>
int main()
{
int no,rem;
printf("\nEnter no\n");
scanf("%d",&no);
int bs=no;
int sum=0;
while(no)
{
rem=no%10;
sum=sum+(pow(rem,3));
no=no/10;
}
if(bs==sum)
printf("The No %d is Armstrongs No.....!!!\n",bs);
else
printf("The No %d is not a Armstrongs NO....!!\n",bs);
return 0;
}





0 comments:
Post a Comment