77.9k views
22 votes
Post a Python program that accepts at least two values as input, performs some computation and displays at least one value as the result. The computation must involve calling one of the predefined functions in the math library. Include comments in your program that describe what the program does. Also post a screen shot of executing your program on at least one test case.

User Toph
by
5.4k points

1 Answer

7 votes

Answer:

In Python:

#The program calculates and prints the remainder when num1 is divided by num2 using the fmod function

import math

num1 = int(input("Input 1: "))

num2 = int(input("Input 2: "))

print(math.fmod(num1, num2))

Step-by-step explanation:

This program begins with a comment which describes the program function

#The program calculates and prints the remainder when num1 is divided by num2 using the fmod function

This imports the math module

import math

The next lines get input for num1 and num2

num1 = int(input("Input 1: "))

num2 = int(input("Input 2: "))

This calculates and prints the remainder when num1 is divided by num2

print(math.fmod(num1, num2))

User JeffMinsungKim
by
5.9k points