Test case work manually correct

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;

}

@Shivam01 you only have to display true and false nothing else here corrected


dont forget to hit like and mark resolved if cleared :smiley:

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.