# FARMSTRONG - Editorial

Author: Vidya kale
Tester: Vidya kale
Editorialist: Vidya kale

CAKEWALK.

None

# PROBLEM:

Find the Armstrong number for a given range of number.

# QUICK EXPLANATION:

Find the Armstrong number for a given range of number .

# SOLUTIONS:

Setter's Solution
``````#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int num, r, sum, t, mm;
int sno, eno;
cin >> sno;
cin >> eno;
for (num = sno; num <= eno; num++)
{
t = num;
sum = 0;
while (t != 0)
{
r = t % 10;
mm = pow(r, 3);
sum = sum + mm;
t = t / 10;
}
if (sum == num)
cout << num << " ";
}
cout << endl;
}
``````
Tester's Solution
``````#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int num, r, sum, t, mm;
int sno, eno;
cin >> sno;
cin >> eno;
for (num = sno; num <= eno; num++)
{
t = num;
sum = 0;
while (t != 0)
{
r = t % 10;
mm = pow(r, 3);
sum = sum + mm;
t = t / 10;
}
if (sum == num)
cout << num << " ";
}
cout << endl;
}
``````
Editorialist's Solution
``````#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int num, r, sum, t, mm;
int sno, eno;
cin >> sno;
cin >> eno;
for (num = sno; num <= eno; num++)
{
t = num;
sum = 0;
while (t != 0)
{
r = t % 10;
mm = pow(r, 3);
sum = sum + mm;
t = t / 10;
}
if (sum == num)
cout << num << " ";
}
cout << endl;
}
``````