0% found this document useful (0 votes)
20 views1 page

Python Programs for Math Operations

The document contains three Python programs: one that displays multiples of 7 below 200, another that calculates the sum of even numbers from 2 to 50, and a third that generates a multiplication table for a user-specified number up to 20. Each program includes code snippets and example outputs. The programs demonstrate basic programming concepts such as loops and arithmetic operations.

Uploaded by

muthulakshmi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Python Programs for Math Operations

The document contains three Python programs: one that displays multiples of 7 below 200, another that calculates the sum of even numbers from 2 to 50, and a third that generates a multiplication table for a user-specified number up to 20. Each program includes code snippets and example outputs. The programs demonstrate basic programming concepts such as loops and arithmetic operations.

Uploaded by

muthulakshmi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1■■ Program to display the multiples of 7 below 200

# Multiples of 7 below 200


for i in range(7, 200, 7):
print(i)
Output:
7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161,
168, 175, 182, 189, 196

2■■ Program to find the sum of even numbers from 2 to 50


# Sum of even numbers from 2 to 50
sum_even = 0
for i in range(2, 51, 2):
sum_even += i
print("Sum of even numbers from 2 to 50:", sum_even)
Output:
Sum of even numbers from 2 to 50: 650

3■■ Program to display multiplication table up to 20


# Multiplication table up to 20
num = int(input("Enter a number: "))
print(f"Multiplication Table of {num}")
for i in range(1, 21):
print(num, "x", i, "=", num * i)
Example Input: 5
Output:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
5 x 11 = 55
5 x 12 = 60
5 x 13 = 65
5 x 14 = 70
5 x 15 = 75
5 x 16 = 80
5 x 17 = 85
5 x 18 = 90
5 x 19 = 95
5 x 20 = 100

You might also like