#include
using namespace std;
bool checkArmstrongNumber(int num);
int main(){
int N;
bool flag;
cin>>N;
flag = checkArmstrongNumber(N);
if(flag ==true)
cout<<“true”;
else
cout<<“false”;
return 0;
}
bool checkArmstrongNumber(int N) {
int temp, sum=0, digit;
bool isArm;
temp =N;
while(temp != 0) {
digit = temp % 10;
sum = sum +(digit * digit * digit);
temp = temp/10;
}
if (sum==N)
isArm =true;
else
isArm =false;
return isArm;
}
This code is compiling successfully, but it shows that 2 test cases fails and I’m not getting full marks.Why this is happening?