Write a c++ program to print Armstrong number for three digits

Write a c++ program to print Armstrong number for three digits. This program will help you to find the Armstrong number in C++. These are basic set program in every programming lanuguage for beginners.

#include <iostream>
using namespace std;
int main() 
{
int num, num1, rem, result = 0;
cout << "Enter the number";
cin >> num;
num1 = num;
while (num1 != 0)
{
rem = num1 % 10;
result += rem * rem * rem;
num1 /= 10;
}
if (result == num)
cout << num << " is Armstrong number";
else
cout << num << " is not Armstrong number";
return 0;
}

Output:

Enter the number567

567 is not Armstrong number