Ask Question
14 February, 10:51

A number x is divisible by y if the remainder after the division is zero. Write a program that tests whether one number is divisible by another number. Read both numbers from the keyboard?

+2
Answers (1)
  1. 14 February, 13:17
    0
    Program:

    x=float (input ("Enter first number")) #take first inputs

    y=float (input ("Enter second number")) #take second inputs

    if (x%y==0) : #check the number is divisible or not

    print ("The number is divisible") #print for true.

    else:

    print ("The number is not divisible") # print for false.

    Output:

    If the user gives input 4 and 2 then it prints that it is divisible. If the user gives inputs 4.2 and 2.2 then it prints that it is not divisible.

    Explanation:

    The above program is in python language. The first and second line of the program renders a message to enter the first and the second number and it take the value from the user and stored it on x and y variable after converting the value on the float. Then the third line is used to check that the x and y are divisible or not. Then it prints that it is divisible for true value otherwise it prints it is not divisible.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A number x is divisible by y if the remainder after the division is zero. Write a program that tests whether one number is divisible by ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers