Number without zeros X10549


Statement
 

pdf   zip

html

Write a program that treats a sequence of integers greater than zero. For each number, the program outputs the value that results from eliminating its 0 digits. For example, eliminating 0 digits from 3097601 results in 39761.

The program must implement and use the following RECURSIVE function:

// Pre: x > 0
// Post: returns the value of x without 0 digits
int remove_zeros(int x) {
    ...
}

Exam score: 2.00 Automatic part: 40.00%

Input

The input is a sequence of integers greater than zero.

Output

For each number, the program outputs the value that results from eliminating its 0 digits.

Observation

A non-recursive implementation of the function invalidates the problem.

Public test cases
  • Input

    3097601
    30970
    3004
    8
    1000000
    467
    
    

    Output

    39761
    397
    34
    8
    1
    467
    
  • Input

    
            
                                

    Output

    
            
                                
  • Information
    Author
    Pro1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++