0% found this document useful (0 votes)
2 views10 pages

Python 10 Programs One Code Per Page-1

The document contains ten Python programs demonstrating basic programming concepts. These include printing 'Hello World', performing arithmetic operations, checking even or odd numbers, finding the largest of two numbers, generating a multiplication table, checking if a number is positive or negative, calculating simple interest, computing the area of a circle, finding the factorial of a number, and generating a Fibonacci series. Each program is presented with code snippets and user input prompts.

Uploaded by

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

Python 10 Programs One Code Per Page-1

The document contains ten Python programs demonstrating basic programming concepts. These include printing 'Hello World', performing arithmetic operations, checking even or odd numbers, finding the largest of two numbers, generating a multiplication table, checking if a number is positive or negative, calculating simple interest, computing the area of a circle, finding the factorial of a number, and generating a Fibonacci series. Each program is presented with code snippets and user input prompts.

Uploaded by

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

Python Programs (10 Codes)

Program 1: Hello World


print("Hello World")
Program 2: Addition of Two Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Sum =", a + b)
Program 3: Even or Odd
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
Program 4: Largest of Two Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a > b:
print("Largest =", a)
else:
print("Largest =", b)
Program 5: Multiplication Table
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)
Program 6: Check Positive or Negative
num = int(input("Enter a number: "))
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
Program 7: Simple Interest
p = float(input("Enter principal: "))
r = float(input("Enter rate: "))
t = float(input("Enter time: "))
si = (p * r * t) / 100
print("Simple Interest =", si)
Program 8: Area of Circle
r = float(input("Enter radius: "))
area = 3.14 * r * r
print("Area =", area)
Program 9: Factorial of a Number
num = int(input("Enter a number: "))
fact = 1
for i in range(1, num + 1):
fact = fact * i
print("Factorial =", fact)
Program 10: Fibonacci Series
n = int(input("Enter number of terms: "))
a, b = 0, 1
print(a)
print(b)
for i in range(2, n):
c=a+b
print(c)
a, b = b, c

You might also like