You are on page 1of 3

Practical No :- 1

Aim: Implement Basic data types, Control structures and operators.


Software used: Python

Question1- Write a program in python to check if a number entered by user is even or


odd.
Implementation:
num = int (input ("Enter any number to test whether it is odd or even:"))
if (num % 2) == 0:
print ("The number is even")
else:
print ("The provided number is odd")
Output:

Question 2- Write a program in python to calculate simple interest taking input from
user
Implementation:
p = int(input("enter the principle amount:"))
t = int(input("enter the time(in yrs):"))
r = int(input("enter the rate of interest:"))
s= (p*r*t)/100
print("The Simple Interest is", s)

Output:

Question 3- Write a program in python to calculate area of a rectangle taking input


from user.
Implementation:
l = int(input("enter the length of the rectangle:"))
b = int(input("enter the breath of the rectangle"))
a= l*b
print("The Simple Interest is", a)

Output: -

Question 4. Write a program in pyton to reverse a number taking input from user.
Implementation:
a=input("Enter the first digit:")
b=input("Enter the second digit:")
print("The number is:",a+b)
print("The reversed number",b+a)
Output:

Question 5- Write a program in python to perform basic calculator operations.


Implementation:
a=int(input("Enter the first number:"))
b=int(input("Enter the second number:"))
print("The addition of the entered numbers will be:",a+b)
print("The substraction of the entered numbers will be:",a-b)
print("The multiplication of the entered numbers will be:",a*b)
print("The division of the entered numbers will be:",a/b)
Output:

You might also like