CHECK WHETHER NUMBER IS ARMSTRONG OR NOT


#include<stdio.h>
#include<conio.h>
void main()
{
int no,a,b,c,org;
printf("Enter Any Number");
scanf("%d",&no);
org=no;
a=no%10;
no=no/10;
b=no%10;
no=no/10;
c=(no*no*no)+(b*b*b)+(a*a*a);
if(c==org)
  {
  printf("Entered Number is Armstrong");
  }
  else
    {
    printf("Entered Number is not Armstrong");
    }
getch();
}

0 comments: (+add yours?)

Post a Comment