using c program please An Armstrong number of three digits i
using c program please
An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3^3 + 7^3 + 1^3 = 371. Write a program to prompt the user for a three digit positive integer n and output whether the number is an Armstrong number or not. Write a function called armstrong which returns 0 if the number is an armstrong number and 1 if it is not an armstrong number. The following function prototype is required:Solution
#include <stdio.h>
#include <math.h>
int main()
{
int number, originalNumber, remainder, result = 0, n = 0 ;
printf(\"Enter an integer: \");
scanf(\"%d\", &number);
originalNumber = number;
while (originalNumber != 0)
{
originalNumber /= 10; ++n;
}
originalNumber = number;
while (originalNumber != 0)
{
remainder = originalNumber%10;
result += pow(remainder, n);
originalNumber /= 10;
}
if(result == number) p
rintf(\"%d is an Armstrong number.\", number);
else
printf(\"%d is not an Armstrong number.\", number);
return 0;
}
