Python program to calculate sum of even and odd numbers from 1 to N; Through this tutorial, i am going to show you how to calculate and print sum of even and odd numbers from 1 to N (10, 100, 500, 100) using loop in python.

## Python Program to Find Sum Of Odd and Even numbers From 1 to N

- Python Program to Print Odd Numbers from 1 to N
- Python Program to Print Even Numbers from 1 to N

### Python Program to Print Odd Numbers from 1 to N

# Python Program to Calculate Sum of Odd Numbers from 1 to N maximum = int(input(" Please Enter the Maximum Value : ")) Oddtotal = 0 for number in range(1, maximum+1): if(number % 2 != 0): print("{0}".format(number)) Oddtotal = Oddtotal + number print("The Sum of Odd Numbers from 1 to {0} = {1}".format(number, Oddtotal))

** Output of the above program; as shown below: **

Please Enter the Maximum Value : 15 1 3 5 7 9 11 13 15 The Sum of Odd Numbers from 1 to 15 = 64

### Python Program to Print Even Numbers from 1 to N

# Python Program to Calculate Sum of Even Numbers from 1 to N maximum = int(input(" Please Enter the Maximum Value : ")) total = 0 for number in range(1, maximum+1): if(number % 2 == 0): print("{0}".format(number)) total = total + number print("The Sum of Even Numbers from 1 to {0} = {1}".format(number, total))

** Output of the above program; as shown below: **

Please Enter the Maximum Value : 8 2 4 6 8 The Sum of Even Numbers from 1 to 8 = 20

## Recommended Python Tutorials

**Recommended:-**Python Program to Add Two Numbers

**Recommended:-**Python Program to Calculate Simple Interest

**Recommended:-**Python Program to Find Average of n Numbers

**Recommended:-**Python Program to ASCII Value of Character

**Recommended:-**Python Program to Calculate Compound Interest

**Recommended:-**Python Program to Check Leap Year

**Recommended:-**Python Program To Print Number Pattern

**Recommended:-**Python Program to Print Star Pattern

**Recommended:-**Python Replace Character in String

**Recommended:-**Python Convert String to Float

**Recommended:-**Python String translate() Method Example

**Recommended:-**Python Convert String to List

**Recommended:-**Python filter() Method

**Recommended:-**Python Map() Method

**Recommended:-**Python String Append

## Be First to Comment