Armstrong no. sum error
#include<iostream> #include<cmath> using namespace std ; int countNum (int) ; int isArmstrongNum (int) ; int countNum(int n){ int digit=0; while (n>0){ n=n/10 ; digit++ ; } return digit ; } int isArmstrong (int n){ int temp,power, sum=0; temp = n; power = countNum(n); while(n>0){ sum = sum + pow (n%10, power) ; n=n/10 ; } return sum==temp; } int main(){ int lower, upper, sum=0 ; cout<< "Enter the lower and upper limit"<<endl; cin>>lower; cin>>upper; while (lower>=upper){ if (isArmstrong(lower)){ sum+=lower ; lower++ ; } } cout<< sum ; return 0; } The isArmstrong function is working but i'm am not getting the sum for lower and upper limit. Can Someone Please point out the error.