Número Armstrong

Programa que dice si un número es un Número de Armstrong.

Scripter

#include<iostream>
using namespace std;
int main()
{
  int n, num, rem, sum = 0;
  cout << "Enter a positive integer: ";
  cin >> num;
  n = num;
  while(n != 0)
  {
    rem = n % 10;
    sum += rem * rem * rem;
    n /= 10;
  }
  if(sum == num)
    cout << num << " is an Armstrong number.";
  else
    cout << num << " is not an Armstrong number.";
  return 0;
  }

Result

Scripter

>>Write the number integer and positive: 153
153 is an Armstrong number
...Program finished with exit code 0
Press ENTER to exit console.

>>Write the number integer and positive: 100
100 is not an Armstrong number
...Program finished with exit code 0
Press ENTER to exit console.