0% found this document useful (0 votes)
7 views3 pages

IX Simple Program

The document contains a series of Python programs that demonstrate basic programming concepts. It includes examples for printing messages, performing arithmetic operations, checking conditions, and calculating areas and interests. Each program is presented with its code and a brief description of its functionality.

Uploaded by

abeer9302178699
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)
7 views3 pages

IX Simple Program

The document contains a series of Python programs that demonstrate basic programming concepts. It includes examples for printing messages, performing arithmetic operations, checking conditions, and calculating areas and interests. Each program is presented with its code and a brief description of its functionality.

Uploaded by

abeer9302178699
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

1.

Print “Hello World”

Program:

print("Hello World")

2. Add Two Numbers

Program:

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))
print("Sum =", a + b)

3. Subtract Two Numbers

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))
print("Difference =", a - b)

4. Multiply Two Numbers

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))
print("Product =", a * b)

5. Divide Two Numbers

a = int(input("Enter dividend: "))


b = int(input("Enter divisor: "))
print("Quotient =", a / b)

6. Check Even or Odd

num = int(input("Enter a number: "))


if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")

7. Find 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)
8. Check Positive, Negative or Zero

num = int(input("Enter a number: "))

if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")

9. Print Numbers from 1 to 10

for i in range(1, 11):


print(i)

10. Find Square of a Number

num = int(input("Enter a number: "))


print("Square =", num * num)

11. Find Cube of a Number

num = int(input("Enter a number: "))


print("Cube =", num ** 3)

12. Simple Interest Calculation

p = int(input("Enter principal: "))


r = int(input("Enter rate: "))
t = int(input("Enter time: "))

si = (p * r * t) / 100
print("Simple Interest =", si)

13. Area of a Rectangle

length = int(input("Enter length: "))


breadth = int(input("Enter breadth: "))
print("Area =", length * breadth)

14. Swap Two Numbers (Using Third Variable)

a = int(input("Enter a: "))
b = int(input("Enter b: "))

temp = a
a=b
b = temp

print("After swapping a =", a, "b =", b)


15. Print Table of a Number

num = int(input("Enter a number: "))

for i in range(1, 11):


print(num, "x", i, "=", num * i)

You might also like