Tux Education Our New Education Channel Please Share And Subscribe It...

/* ArmStrong Number */


// Compiler : Dev C++4.9.9.2

#include<stdio.h>

int main()
{
    int num,r,sum=0,temp;
    
    printf("Number : ");
    scanf("%d",&num);
    
    temp=num;
    
    while(num!=0)
    {
                 r=num%10;
                 num=num/10;
                 sum=sum+(r*r*r);
    }
    
    if(sum==temp)
    printf("\n\n%d Is Armstrong Number.",temp);
    else
    printf("\n\n%d Is Not Armstrong Number.",temp);
    
    getch();
    
    return 0;
}

Post a Comment