Dremendo Tag Line

Input 2 decimal numbers and check ceil value of the remainder is even or odd using mathematical functions in Python

Mathematical Functions - Question 5

In this question, we will see how to input two decimal numbers and check if the ceil value of their remainder is even or odd in Python programming using the mathematical functions. To know more about mathematical functions click on the mathematical functions lesson.

Q5) Write a program in Python to input two decimal numbers and check if the ceil value of their remainder is even or odd.

Program

import math

print('Enter 2 decimal numbers')
a=float(input())
b=float(input())
r=math.fmod(a,b)
x=math.ceil(r)
if x%2==0:
    print('Even Number')
else:
    print('Odd Number')

Output

Enter 2 decimal numbers
11.31
7.24
Odd Number
video-poster