A C Program to Find Armstrong Number April 13, 2021 Check The Given Number Is Armstrong Number/* C program to check whether a number is armstrong or not */ #include <stdio.h> int main(){ int number, sum=0, rem=0,tempNumber; printf("Enter an integer number: "); scanf("%d", &number); tempNumber=number; while(tempNumber!=0) { rem=tempNumber%10; sum=sum + (rem*rem*rem); tempNumber/=10; } /* checking number is armstrong or not */ if(sum==number) printf("%d is an Armstrong number.",number); else printf("%d is not an Armstrong number.",number); return 0;}-----------------------------------------------------------Output Tweet Share Share Share Share About Code2Chef Computer Hardware or Software does nothing without a computer program guiding. Related Post
ConversionConversion EmoticonEmoticon