#include
using namespace std;
long long int reverse(long long int n){
long long int sum=0;
while(n!=0){
sum=sum10+n%10;
n=n/10;
}
return sum;
}
long long int replace(long long int n){
long long int sum=0,num=0;
if(n==0)
return 0;
while(n!=0){
num=n%10;
if(num==0){
num=5;
}
sum=sum10+num;
n=n/10;
}
return reverse(sum);
}
int main() {
long long int n;
cin>>n;
cout<<replace(n);
return 0;
}
Not able to pass all Test cases(One test case showing wrong ans)
if n is 0 you have to return 5
not 0
change this
all testcase will passed
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.