When I run the test case manually it shows the correct output but when compiler reads it shows error.
I don’t know why…Please Help!!!
Below is my code :-
#include
using namespace std;
int main() {
long int n,a = 0, b = 0, ans = 0, ansf = 0,w ,s ,p = 1;
cin>>n;
w = n;
s = n;
while(n!=0)
{
a = n%10;
ans++;
//cout<<ans<<endl;
n /= 10;
}
while(s!=0)
{
p = 1;
b = s%10;
cout<<b<<endl;
for(int i = 0; i<ans; i++)
{
//cout<<b<<endl;
p *= b;
//cout<<p<<endl;
}
ansf += p;
s /= 10;
}
cout<<ansf<<endl;
if(ansf == w)
cout<<"true"<<endl;
else
cout<<"false"<<endl;
return 0;
}
