Answers for "c program to print whether a number is armstrong or not"

C
1

c program to check the number is armstrong or not

#include <stdio.h>
#include <math.h>
void main ()
{
    int n,t,r,c,s=0;
    printf("Enter the number: ");
    scanf("%d",&n);
    t=n;

        while(t!=0)
        {
            r=t%10;
            c=pow(r,3);
            s=s+c;
            t=t/10;
        }

        if(s==n)
            printf("Armstrong");
        else
            printf("Not Armstrong");
}
Posted by: Guest on June-24-2021

Code answers related to "c program to print whether a number is armstrong or not"

Code answers related to "C"

Browse Popular Code Answers by Language