Computer Science, asked by Aswin222, 1 year ago

2 write a c++ program find all amstrong numbers below 1000?

Answers

Answered by AJAYMAHICH
0
#include <cmath>

using namespace std;

int main()

{

int sum, num;

cout<<"Armstrong numbers between 1 and 1000: ";

for(int i = 0; i < 10; i++)

{

for(int j = 0; j < 10; j++)

{

for(int k = 0; k < 10; k++)

{

num = i * 100 + j * 10 + k;

sum = pow(i, 3) + pow(j, 3) + pow(k, 3);

if(num == sum)

cout<<num<<"  ";


}

}


}


return 0;

}
Similar questions