Hey there, I am new here,need help

I want to solve an exercice that requires to find if a number is "Armstrong number" or not..I coded it but some problems are appearing there.Please give me some tips.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 #include <iostream>

using namespace std;

bool Armstrong (int numri, int i)
{
    int nd= numDigits (numri);
    int d= getDigit (numri, i);

    for (int i=1;i<=nd;i++)
    {
        int sum=0;
        sum=sum+power(d, nd);
    }

    if (sum==numri) return true;
    else return false;
}

int main ()
{
    int num1,num2,cnt=0;
    cin >> num1 >> num2;
    for (int i=num1;i<=num2;i++)
        if (Armstrong(i)) cnt++;
    cout << cnt;
    return 0;
}
Topic archived. No new replies allowed.