You are on page 1of 3

1.

Develop a program of calculator by taking values from user to perform arithmetic


operations and display the results.
a=int(input("enter first number"))
b=int(input("enter second number"))
sum=a+b
sub=a-b
mul=a*b
div=a/b
f=a//b
e=a**b
rem=a%b
print(f"sum of {a} and {b} = {sum}")
print(f"difference of {a} and {b} = {sub}")
print(f"product of {a} and {b} = {mul}")
print(f"quotient of {a} and {b} = {div}")
print(f"floor of {a} and {b} = {f}")
print(f"power of {a} and {b} = {e}")
print(f"remainder of {a} and {b} = {rem}")

2. Write a python program to calculate the area of a circle.

r= int(input("enter radius"))
a=(3.142*r*r)
print(f"area of a circle={a}")

3. Write a python program to calculate the simple interest.

p= int(input("enter principal amount"))


t= int(input("enter time"))
r= int(input("enter rate of intererst"))
si = (p*t*r)/100
print(f"Simple Interest ={si}")

4. Write a python program to swap 2 numbers.

a= int(input("enter a number"))
b= int(input("enter a number"))
print(f"Before Swapping a={a} b={b}")
c=a
a=b
b=c
print(f"After Swapping a={a} b={b}")

5. Write a python program to check given number is positive or negative.

a= int(input("enter a number"))
if a>0:
print("number is positive number")
else:
print("number is negative number")

6. Write a python program to check whether a given number is odd or even.

num= int(input("enter a number"))


rem = num%2
if rem==0:
print("number is even")
else:
print("number is odd")

7. Write a python program to find the larger of 2 numbers.

a= int(input("enter a number"))
b= int(input("enter a number"))
if a>b:
print(f"{a} is bigger")
else:
print(f"{b} is bigger")

8. Write a python program to find the largest of 3 numbers.

a= int(input("enter a number"))
b= int(input("enter a number"))
c= int(input("enter a number"))
if (a>b and a>c):
print(f"{a} is bigger")
if (b>a and b>c):
print(f"{b} is bigger")
if (c>a and c>b):
print(f"{c} is bigger")

9. Write a python program to check given number is positive or negative or zero.

a= int(input("enter a number"))
if a>0:
print("number is positive number")
elif a==0:
print("number is zero")
else:
print("number is negative number")

10. Write a python program to print the grade of a student based on percentage.

p= float(input("enter the percentage of a student"))


if p>=80 and p<=100:
print("DISTINCTION")
elif p>=60 and p<80:
print("FIRST CLASS")
elif p>=50 and p<60:
print("SECOND CLASS")
elif p>=35 and p<50:
print("PASS")
else:
print("FAIL")

You might also like