I solved this q but i got one new method..but this one is failing one test case...Will you help about it?

#include
using namespace std;
int check(int n){
int num = 0;
int i = 1;

	 if (n==0){
		 return 5;
	 }
 while(n!=0){
		int digit = n%10;
		if(digit == 0){
			digit = 5;
			}
		num = num + i*digit;
		i *= 10;
		n /= 10;
	 }
 return num;

}

int main() {
int n;
cin>>n;
cout<<check(n);
return 0;
}

in your above mentioned code all test cases are passing…
check them once again…

with the same code:

sir it is not passing one test case

i checked it 4 to 5 times

image

for me it’s passing all testcases

can you try again the same code, i share with you?

yes sir do share it again

image

you can see yourself sir

use long long int becase here the number is big
check now

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.