Sir, not showing either code is correct or not

Compilation result is also coming
#include
using namespace std;

int main() {
int n,temp,rem,sum;
cin >> n;
temp =n;
while(n>0){
rem = n%10;
sum = sum + (rem * rem * rem);
n = n / 10;
}
if ( sum == temp)
cout << “true” << endl;
else cout << “false” << endl;

return 0;

}

@naveengandhinow your code will only works for 3 digit number,Armstrong number is where you have to calculate sum of power(rem,no_of_digit_in_n) but your are taking only power of 3.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.