Amstrong no check

#include
#include<math.h>
using namespace std;
int main() {
long long int n;
cin>>n;
long long int r;
int digit=0;
while(n>0){
r=n%10;
digit++;
n=n/10;
}
long long int b;
long long int ans=0;
while(n>0){
b=n%10;
ans=pow(b,digit)+ans;
n=n/10;
}
if(ans==n){
cout<<“true”<<endl;
}
else{
cout<<“false”<<endl;
}
return 0;
}

please check my code where did I went wrong

3 test case failed 2 3 and 5 rest all are okay

please help me out of this reply me fast

please reply me fast

Hi… pls save ur code on ide and send… or u can refer my code https://ide.codingblocks.com/s/603438

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.

so I did everything correct just I had to take n in another variable so that n value will not change

yes… correct…

please send me this code without using pow function I had tried many time but Iits not working is it a way to do this exponent without using pow then just send me that part or else for exponent we always have to use pow function

bhai power nikalne mei kya dikkat hai… ek loop lgao hojega…
refer this https://www.geeksforgeeks.org/write-a-c-program-to-calculate-powxn/

ho gaya mujhse hi glut ho ja rea tha minor mistake tha neend me

okay… cool…