Armstrong Number
C Program For Checking Number Is Armstrong Or Not Source Code: #include<stdio.h> #include<conio.h> #include<math.h> void main() { int n,m,s=0; clrscr(); printf("\nEnter a number:"); scanf("%d",&n); m=n; while(n>0) { s=s+pow(n%10,3); n=n/10; } if(s==m) { printf("%d is a armstrong number",m); } else { printf("\nNot armstrong no."); } getch(); } output
Tags:
C Program
0 comments