Online Examination System for all learner!!! coming soon..

C : Program to check given number is armstrong or not.

Code:

#include<stdio.h>
#include<conio.h>
main()
{
        int n,x;
        printf("Enter a number:");  
        scanf("%d",&n);
        x=armstrong(n);
        if(x==n)
                printf("Arm strong");
        else
                printf("Not arm strong");
}

int armstrong(int num)
{
        int sum=0,r;
        while(num!=0)
        {
                r=num%10;
                num=num/10;
                sum=sum+(r*r*r);
        }
        return sum;
}


Output:

Enter a number:1

Arm strong 

C Programming Online Test 1

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answ...