Computer Science
Write a Python program that accepts two integers from the user and prints a message saying if first number is divisible by second number or if it is not.
Python
Python Funda
53 Likes
Answer
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a % b == 0:
print(a, "is divisible by", b)
else:
print(a, "is not divisible by", b)
Output
Enter first number: 15
Enter second number: 5
15 is divisible by 5
Enter first number: 13
Enter second number: 7
13 is not divisible by 7
Answered By
25 Likes
Related Questions
Write a program that returns True if the input number is an even number, False otherwise.
Write a Python program that calculates and prints the number of seconds in a year.
Write a program that asks the user the day number in a year in the range 2 to 365 and asks the first day of the year — Sunday or Monday or Tuesday etc. Then the program should display the day on the day-number that has been input.
One foot equals 12 inches. Write a function that accepts a length written in feet as an argument and returns this length written in inches. Write a second function that asks the user for a number of feet and returns this value. Write a third function that accepts a number of inches and displays this to the screen. Use these three functions to write a program that asks the user for a number of feet and tells them the corresponding number of inches.