7

Python Program to Print all Odd Numbers in a Range

 1 year ago
source link: https://www.geeksforgeeks.org/videos/python-program-to-print-all-odd-numbers-in-a-range/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Python Program to Print all Odd Numbers in a Range

Python Program to Print all Odd Numbers in a Range
So and then I come to each buggies today we're going to learn how
  • 20/07/2022

In this video, we will see how to print odd numbers in a range using Python. 
We have covered the following : What are the odd numbers, dry run of the code & the approaches.

To print the odd numbers we will be using modulus.

To calculate the remainder of an integer after it has been divided by any divisor, we utilize this operator.

Even Number: A number is even number if it is totally divisible by two leaving no remainder.
Odd Number: A number is odd number if it is not divisible by two & results in a single remainder.

To find the odd, we use the modulus operator. If num percent 2 == 0, the remainder is 0, indicating that the given number is even. Otherwise, if num percent 2!= 0, the remainder is not zero, indicating that the provided number is odd.

Python Program to Print all odd numbers in a range:
https://www.geeksforgeeks.org/python-program-to-print-all-odd-numbers-in-a-range/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK