Will you please help me in this code , because this shows that did you account for negative values?

#include
using namespace std ;
int main()
{
int num;
cin>>num;
int n,i=0;
while(num>0)
{
n=num%10;
if(n==0)
{
n=5;
}
i = (i10)+n;
num=num/10;
}
int j=0;
while(i>0)
{
n=i%10;
j= (j
10)+n;
i=i/10;
}
cout<<j;
return 0;
}

hi @deepshreyamishra301_1918130c8477386b
refer this–>

#include <iostream>
using namespace std;

long long int reverse(long long int num)
{
    long long int rev=0, rem;
    while(num!=0)
    {
        rem=num%10;
        rev=rev*10+rem;
        num/=10;
    }
    return rev;
}
long long int replacezero(long long int n)
{
    long long int digit, result=0;
    if (n==0){
        return 5;
    }
    else{
        while (n!=0){
            digit=n%10;
            if (digit==0){
                digit=5;
            }
            result=result*10+digit;
            n/=10;
        }
        return reverse(result);
    }
}

int main()
{
    long long int num;
    cin>>num;
    cout<<replacezero(num)<<endl;
}

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.