Friday, February 1, 2019

Odd Print

  • Problem Description

    Write a program to print all the odd numbers between two ranges(Include the range too)

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output
  • CODING ARENA
  • lower=int(input())
    upper=int(input())
    for i in range(lower,upper+1):
        if(i%2!=0):
            print(i)
  • Test Case 1

    Input (stdin)
    1
    
    11
    
    
    Expected Output
    1
    
    3
    
    5
    
    7
    
    9
    
    11
  • Test Case 2

    Input (stdin)
    24
    
    38
    
    
    Expected Output
    25
    
    27
    
    29
    
    31
    
    33
    
    35
    
    37

No comments:

Post a Comment