C Program To check whether number is armstrong or not
#includemain() { int n,tot=0,tmp,d; clrscr(); printf("\n enter the number"); scanf("%d",&n); tmp=n; while(n>0) { d=n%10; tot=(d*d*d)+tot; n=n/10; } if(tmp==tot) printf("\n enter number is armstrong"); else printf("enter number is not armstrong"); getch(); }
No comments:
Post a Comment