Test cases failing

tast cases are failing. no idea what is the reason

hi… pls share ur code… only then will i be able to check

#include #include using namespace std; int main() { long int n; cin >> n; long int a=0; for(int i=1;n>0;i++){ int x = n%10; if(x==0){ a = a + 5pow(10 , i-1); }else{ a = a + xpow(10 , i-1); } n=n/10; } cout << a << endl; return 0; }

hi… pls save it on ide and send

cant you use chat box

hi… ur code is fine… its just failing on one test case ie n = 0. for this ans should be 5 but ur code is giving 0.
so just put an initial check that if n=0 return ur ans as 5

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.