Help me correct

please help me correct my code

You have done many things wrong

join this meet


i will explain

#include<iostream>
#include<climits>
using namespace std;

int main(){
    long long int n;
    cin>>n;
    long long int pv = 1;
    long long int  ans = 0;;
    while(n){
        int digit = n%10;
        if(digit==0){
            digit = 5;
        }
        ans += digit*pv;
        pv = pv*10;
        n = n/10;
    }
    if(n==0)
        cout<<5<<endl;
    else
        cout<<ans;
    return 0;
}

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.

now test cases 0 and 1 are failing :frowning:

instead of n make it
if(ans==0)
here

after this it will work
because n will always be zero after while loop

is this working now?

and also you have not given your feedback plz rate your experience from above post