Write a C Language Program To Check Given Number is Armstrong Or Not ?

Defination: Write a C Language Program To Check Given Number is Armstrong  Or Not ?

Source Code ::
void main()
{
    int a=1,c,d=0,e;
    clrscr();
    e=a;
    do
    {
        a=e;
        d=0;
        while(a>0)
        {
            c=a%10;
            d=d+(c*c*c);
            a=a/10;
            }
        if(e==d)
        {
            printf(" \nArmstrong Nouber is%d ",e);
        }
    e++;
    }while(e<=1000);
    getch();
}
Write a C Language Program To Check Given Number is Armstrong Or Not ? Write a C Language Program To Check Given Number is Armstrong  Or Not ? Reviewed by Unknown on 21:17 Rating: 5

No comments:

Powered by Blogger.