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
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course