Help pls! one testcase not working

#include
#include<math.h>
using namespace std;

int main() {

long long int n;
cin>>n;

long long int ans=0;
int a=0;

while(n>0){
	int ld=n%10;
	if(ld==0) ld=5;
	ans+=ld*pow(10,a);
	a++;
	n/=10;
}

cout<<ans;


return 0;

}

hi @anshul3558_e8c9aa486c392ca3, what if n is 0 ??
handle that case separately

#include <bits/stdc++.h>

using namespace std;

int main() {

long long int n;

cin>>n;

long long int ans=0; //missing

int a=0;

if(n == 0)ans = 5;

while(n>0){

int ld=n%10;

if(ld==0) ld=5;

ans+=ld*pow(10,a);

a++;

n/=10;

}

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.