0% found this document useful (0 votes)
2 views

PYTHONPROGRAMSClassVIII

The document contains Python programs for various arithmetic operations, including addition, subtraction, multiplication, division, and exponentiation. It also includes programs for calculating simple interest, the area and perimeter of a rectangle, printing user details, and determining voting eligibility, as well as checking if a number is odd or even and identifying if a number is positive, negative, or zero.

Uploaded by

Kriti sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

PYTHONPROGRAMSClassVIII

The document contains Python programs for various arithmetic operations, including addition, subtraction, multiplication, division, and exponentiation. It also includes programs for calculating simple interest, the area and perimeter of a rectangle, printing user details, and determining voting eligibility, as well as checking if a number is odd or even and identifying if a number is positive, negative, or zero.

Uploaded by

Kriti sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON PROGRAMS(CLASS VIII)

1.Program to perform all arithematic operations 2. Program to power entering two numbers

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


b=int(input("Enter second number :")) b=int(input("Enter second number :"))
sum=a+b pow = a**b
dif=a-b print("Power is : ",pow)
mul=a*b
quo=a/b
rem=a%b
exp=a**b
print("Sum is : ",sum)
print("Difference is : ",dif)
print("Product is : ",mul)
print("Quotient is : ",quo)
print("Remainder is : ",rem)
print("Exponent is : ",exp)
3. Program to find Simple Interest 4. Program to find area and perimeter of rectangle

p=int(input("Enter principle :")) l = float(input("Enter length : "))


r=int(input("Enter rate of interest :")) b = float(input("Enter breadth :"))
t=int(input("Enter time : ")) area = l * b
si= (p*r*t)/100 perimeter = 2*(l+b)
print("Simple Interest is : ",si) print("Area of rectangle is : ",area)
print("Perimeter of rectangle is :",perimeter)
5. Program to enter and print your name and age 6. Program to find if person is Eligible to Vote or not

n= input("Enter name : ") age = int(input("Enter age :"))


age = input("Enter age :") if (age) >= 18 :
print ("Hello ! " , n , " your age is ",age) print ("Eligible to vote ")
else :
print("Not eligible to vote ")
7. Program to find whether number is odd or even 8. Program to find if number is Positive, Negative or Zero

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


if (n%2)==0: if (n)> 0:
print(n , " is Even number") print(n , " is Positive number")
else: elif (n)==0:
print(n , " is Odd number")
print(n , " is zero")
else :
print(n , " is negative")

You might also like