Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scratchyourbrain/1cdfa469945c93bccb99 to your computer and use it in GitHub Desktop.
Save scratchyourbrain/1cdfa469945c93bccb99 to your computer and use it in GitHub Desktop.
C Program to Display Armstrong Number Between Two Intervals
#include <stdio.h>
int main()
{
int n1, n2, i, temp, num, rem;
printf("Enter two numbers(intervals): ");
scanf("%d %d", &n1, &n2);
printf("Armstrong numbers between %d an %d are: ", n1, n2);
for(i=n1+1; i<n2; ++i)
{
temp=i;
num=0;
while(temp!=0)
{
rem=(temp%10);
num+=rem*rem*rem;
temp/=10;
}
if(i==num)
{
printf("%d ",i);
}
}
return 0;
}
@mani357
Copy link

mani357 commented Feb 20, 2018

Output plss

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