Wednesday, 3 May 2017

Program to check no is Armstrong or not.

#include<studio.h>
void main( )
{ int no,sum =0,r,x;
printf ("\n enter no ");
scanf("%d",&no);
x=no;
while (no>0)
{
r=no%10;
sm=sm+(r*r*r);
no=no/10;
}
if(sum==x)
{
printf("\n It is Armstrong no");
}
else
{printf(" not Armstrong no");
}

No comments:

Post a Comment

Program to display ASCII value of any character.

Program #include<studio.h> #include<condo.h> void main( ) { char ch; clrscr(); printf("\n enter any character...