Skip to content

Instantly share code, notes, and snippets.

@scratchyourbrain
Created December 24, 2014 07:05
Show Gist options
  • Save scratchyourbrain/0571336445479a6fe1e9 to your computer and use it in GitHub Desktop.
Save scratchyourbrain/0571336445479a6fe1e9 to your computer and use it in GitHub Desktop.
C program to Check Armstrong Number
#include <stdio.h>
int main()
{
int n, n1, rem, num=0;
printf("Enter a positive integer: ");
scanf("%d", &n);
n1=n;
while(n1!=0)
{
rem=n1%10;
num+=rem*rem*rem;
n1/=10;
}
if(num==n)
printf("%d is an Armstrong number.",n);
else
printf("%d is not an Armstrong number.",n);
}
@VigneshSaravanan08
Copy link

I need a C program for armstrong no for 4 digits

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