AI
PRACTICAL
FILE
NAME:
CLASS:
ROLL NO.:
PRACTICAL-1
#WAP to calculate the area and perimeter of a Rectangle
SOURCE CODE:
l=int(input("Enter the legnth of the rectangle:"))
b=int(input("Enter the breadth of the rectangle:"))
per= 2*(l+b)
area= l*b
print("Perimetr of the ractangle is",per,"and area of the rectangle is",area)
OUTPUT:
PRACTICAL-2
#WAP to check whether the given number is even or odd
SOURCE CODE:
num=int(input("Enter a number:"))
if(num%2)==0 :
print("The given number is Even")
else:
print("The given number is Odd")
OUTPUT:
PRACTICAL-3
#WAP to calculate area and circumference of a circle
SOURCE CODE:
r=int(input("Enter the radius of the circle:"))
area=(22/7)*r*r
circ=2*(22/7)*r
print("Area of the circle is",area,"and circumference of the circle",circ)
OUTPUT:
PRACTICAL-4
#WAP to calculate area of a triangle
SOURCE CODE:
b=int(input("Enter the base of the triangle:"))
h=int(input("Enter the height of the triangle:"))
area=(h*b)/2
print("The area of the tringle is",area)
OUTPUT:
PRACTICAL-5
# WAP to input five subject marks of a student from the user and calculate the average
and total law of marks
SOURCE CODE:
eng=int(input("Enter your marks of the subject English:"))
hin=int(input("Enter your marks of the subject Hindi:"))
math=int(input("Enter your marks of the subject Maths:"))
sci=int(input("Enter your marks of the subject Science:"))
sst=int(input("Enter your marks of the subject SST:"))
total=eng+hin+math+sci+sst
avg=total/5
print("Total marks are",total)
print("Average marks are",avg)
OUTPUT:
PRACTICAL-6
#WAP to create a basic calculator (+, -, *, /)
SOURCE CODE:
num1=int(input("Enter the first input: "))
num2=int(input("Enter the second input: "))
oper=input("Enter the type of operation you want to perform (+, -, *, /): ")
result = 0
if oper == "+":
result = num1+num2
elif oper == "-":
result = num1-num2
elif oper == "*":
result = num1*num2
elif oper == "/":
result = p/q
else:
print("Invalid Input")
Print(“your answer is”,result)
OUTPUT: