Armstrong Number in C|Learnerspage

0
48
Armstrong Number

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
int n, remainder, result = 0;
printf(“Enter a three digit integer: “);
scanf(“%d”, &n);
while (n > 0)
{
remainder = n%10;
result += pow(remainder,3);
n = n/10;
}
if(result == n)
{
printf(“%d is an Armstrong number.”,number);
}
else
{
printf(“%d is not an Armstrong number.”,n);
}
getch();
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here