Note: Armstrong numbers are those numbers if we take cube of their digits individually and add them then it will equal to the number. e.g: 153 1^3 + 5^3 + 3^3 = 153
#include <iostream> #include <conio.h> using namespace std;
int main() { int remainder, temp, sum=0, num, i;
cout << "Enter a number: "; cin >> i;
num = temp = i; while(temp != 0) { remainder = temp%10; sum = sum + remainder*remainder*remainder; temp = temp/10; } if(num == sum) cout << "Number is Armstrong." <<endl; else cout << "Number is not Armstrong." <<endl;