Write a program in C++ to check the number is armstrong or not
#include<iostream.h>
#include<conio.h> #include<math.h> void main() { clrscr(); int n,d=0,s=0; cout<<"Enter a no."<<endl; cin>>n; int p=n; while(n!=0) { d=n%10; s=s+pow(d,3); n=n/10; } if(s==p) { cout<<"Armstrong"<<endl; } else cout<<"Not"<<endl; getch(); } |