Replace them all

why test case 1 is failing?

#include
using namespace std;

// Returns the number to be added to the
// input to replace all zeroes with five
int calculateAddedValue(int number)
{

// Amount to be added
long long int result = 0;

// Unit decimal place
int decimalPlace = 1;
 
if (number == 0)
{
    result += (5 * decimalPlace);
}

while (number > 0)
{
    if (number % 10 == 0)
    {
         
        // A number divisible by 10, then
        // this is a zero occurrence in
        // the input
        result += (5 * decimalPlace);

    }
     
    // Move one decimal place
    number /= 10;
    decimalPlace *= 10;
}
return result;

}

int replace0with5(int number)
{
return number += calculateAddedValue(number);
}

int main(){
long long int n;
cin>>n;
cout << replace0with5(n);

return 0;

}

hi @karanaggarwal708_71435e604edb5689, just replace int with long long int everywhere

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.