Friday, February 1, 2019

Smallest Divisible

  • Problem Description

    Write a program to print the smallest divisible of the given number.

    The smallest divisible should start from 2.

    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
  • n=int(input())
    a=[]
    for i in range(2,n+1):
        if(n%i==0):
            a.append(i)
    a.sort()
    print(a[0])
  • Test Case 1

    Input (stdin)
    75
    
    
    Expected Output
    3
  • Test Case 2

    Input (stdin)
    4
    
    
    Expected Output
    2

No comments:

Post a Comment