Computer Science, asked by pranaykumar114, 11 months ago

Write A program to enter a number and check whether it is an Armstrong's number or not using loops. (IN C++)

Answers

Answered by anuj7kumar
1
#include
using namespace std;

int main()
{
int num, temp, rem, sum = 0;

cout << "Enter a number: ";
cin >> num;

temp = num;
while (num != 0)
{
rem = num % 10;
sum += rem * rem * rem;
num = num / 10;
}
if (temp == sum)
cout << temp << " is an Armstrong number" << endl;
else
cout << temp << " is not an Armstrong number" << endl;

return 0;
}

Answered by Smartboy44529
0

Explanation:

Looping includes in Q Basic formula

Similar questions