#include<constream.h> int arm(int); void main() { clrscr(); int n,n1,x; cout<<"\n enter n:"; cin>>n; n1=n; x=arm(n); if(x==n1) cout<<"armstrong"; else cout<<"not"; getch(); } int arm(int n) { int s=0,r; while(n>0) { r=n%10; s=s+r*r*r; n=n/10; } return s; }
Sunday, 7 December 2014
C++ program to check given number is Armstrong or not
Posted by Madan
Posted on 14:21