Write a program to print the odd values in the given rangeInput FormatTwo space separated integers - 'start' and 'end'Output FormatDisplay all the odd numbers between 'start' and 'end'Sample Input10 20Sample Output11 13 15 17 19
Question
Write a program to print the odd values in the given rangeInput FormatTwo space separated integers - 'start' and 'end'Output FormatDisplay all the odd numbers between 'start' and 'end'Sample Input10 20Sample Output11 13 15 17 19
Solution
Sure, here is a Python program that prints the odd values in a given range:
# Function to print odd numbers in a given range
def print_odd_numbers(start, end):
for i in range(start, end +
Similar Questions
Write a program to print only the even numbers till given NInput FormatA single integer 'N'Output FormatDisplay all the even numbers between 0 and NSample Input10Sample Output0 2 4 6 8 10
Write a program to accept an integer N and print the sum of first N odd numbersInput Format:An integer range is given inputOutput Format:Print only calculated sum.Constraints:1 <= N <= 10^16 Sample Input 1:2Sample Output 1:4Sample Input 2:10Sample Output 2:100
Find the sum of even numbers in the given range.Input Format:Accept two integer as inputOutput Format:Print the output as sum of even number available in the given rangeConstraints:1 <= INPUT <= 10^15Sample Input 1:10 20Sample Output 1:90Sample Input 2:30 33Sample Output 2:62
Given an array of N positive integers, print the positive integers that have both the adjacent element values as odd or even.Boundary Condition(s):3 <= N <= 1000Input Format:The first line contains N.The second line contains N elements separated by space(s).Output Format:The first line contains the elements (which have both the adjacent element values as odd or even) separated by a space.Example Input/Output 1:Input:710 21 20 33 98 66 29Output:21 20 33Example Input/Output 2:Input:511 21 30 99 52Output:30 99
Write a program to print the multiples of given N within the rangeInput FormatThree space separated integers - 'N', 'start' and 'end'Output FormatPrint the multiple of given N within the range.Sample Input 15 1 10Sample Output 15 10 15 20 25 30 35 40 45 50Sample Input 25 10 15Sample Output 250 55 60 65 70 75
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.