wap to check wether a number is armstrong or not between 100 to 999
1
Expert's answer
2013-04-03T10:33:16-0400
#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; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment