Skip to content

Instantly share code, notes, and snippets.

@ericdeans
Created September 18, 2017 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericdeans/9fb3703b6da21ca6bc45e6d40430b4da to your computer and use it in GitHub Desktop.
Save ericdeans/9fb3703b6da21ca6bc45e6d40430b4da to your computer and use it in GitHub Desktop.
Program To Check Armstrong Number of Three Digits.
#include <stdio.h>
int main()
{
int number, originalNumber, remainder, result = 0;
printf("Enter a three digit integer: ");
scanf("%d", &number);
originalNumber = number;
while (originalNumber != 0)
{
remainder = originalNumber%10;
result += remainder*remainder*remainder;
originalNumber /= 10;
}
if(result == number)
printf("%d is an Armstrong number.",number);
else
printf("%d is not an Armstrong number.",number);
return 0;
}
@ericdeans
Copy link
Author

To learn this program,you should have basic knowledge of C Programming and Freedom apk.
The output for the above program would be:
Enter a three digit integer: 371
371 is an Armstrong number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment