Write a program to know whether the input number is an armstrong number
Write a program to know whether the input number is an armstrong number
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
#include <stdio.h>
#include <math.h>
void main()
{
int num, sum = 0, rem = 0, cube = 0, temp;
printf (“enter a num”);
scanf(“%d”, &num);
temp = num;
while (num != 0)
{
rem = num % 10;
cube = pow(rem, 3);
sum = sum + cube;
num = num / 10;
}
if (sum == temp)
printf (“The given no is armstrong number”);
else
printf (“The given no is not a armstrong number”);
}