Python – Find all pairs of consecutive odd positive integer smaller than a with sum greater than b
Given two positive integers a and b, the task is to write a program in python to find all pairs of consecutive odd numbers which are smaller than the first number a and their sum should be greater than the second number b.
Input: a = 60 b = 100 Output: Pairs of consecutive number are: 51 , 53 53 , 55 55 , 57 57 , 59 Input: a = 20 b = 200 Output: None
Two numbers are given and then check if they are a positive integer and checked for the first number to be greater than the half of the second number. Then we will check for odd positive integer and assigned in a variable a. In the while statement, pairs of the odd consecutive integers are found and printed.
a = 60 b = 100 Pairs of consecutive number are: 51 , 53 53 , 55 55 , 57 57 , 59
a = 20 b = 200 None