HOT C PROGRAMS BLOGSPOT

HOT C PROGRAMS BLOGSPOT

Click On Related Results For More Information

Wednesday 3 October 2012

Checks Whether a number is armstrong no. or not

Program To Check Whether A no Is Armstrong No. Or Not

/* Checks Whether a number is armstrong no. or not*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
    clrscr();
    int l,num,rem,sum=0;
    printf("Enter any number\n");
    scanf("%d",&num);
    l=num;
    while(num>0)
    {
    rem=num%10;
    num=num/10;
    sum=sum+pow(rem,3);
    }
    if(l==sum)
    printf("AMSTRONG NUMBER");
    else
    printf("NOT A AMSTRONG NUMBER");
    getch();
    }

No comments:

Post a Comment