Ask Question
11 November, 00:32

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?

+4
Answers (1)
  1. 11 November, 02:26
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers