64 613
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #27496 in C++ for surabind Debbarma

Question #27496
wap to check wether a number is armstrong or not between 100 to 999
Expert's answer
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
/* Check every 3-digit number abc
* whether it's an armstrong number */
for (int a = 1; a <= 9; a++)
for (int b = 0; b <= 9; b++)
for (int c = 0; c <= 9; c++)
if (pow(a, 3) + pow(b, 3) + pow(c, 3) == 100 * a + 10 * b + c)
cout << a << b << c << endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions