PROGRAM - 1
SUM OF TWO NUMBERS
AIM
Write a python program to input two numbers and find the sum
SOURCE CODE
num1=int(input("Enter First Number:"))
num2=int(input("Enter Second Number:"))
sum=num1+num2
print("Sum: ",sum)
OUTPUT
Enter First Number:10
Enter Second Number:20
Sum: 30
PROGRAM – 2
ARITHMETIC CALCULATOR
AIM
Write a python program to perform all the basic arithmetic operations (+, -, *, /, //, %,**)
SOURCE CODE
num1=int(input(“Enter First Number:”))
num2=int(input(“Enter Second Number:”))
sum=num1+num2
diff= num1-num2
prod= num1*num2
fl_div= num1/num2
int_div= num1//num2
rem= num1%num2
pow= num1**num2
print(“Sum: “,sum)
print(“Difference: “,diff)
print("Product: ",prod)
print("Division: ",fl_div)
print("Integer Division: ",int_div)
print("Remainder: ",rem)
print("Power: ",pow)
OUTPUT
Enter First Number:10
Enter Second Number:3
Sum: 13
Difference: 7
Product: 30
Division: 3.3333333333333335
Integer Division: 3
Remainder: 1
Power: 1000
PROGRAM - 3
SIMPLE AND COMPOUND INTERESTS
AIM
Write a python program to find simple interest and compound interest.
𝑇
SI= 𝑃R𝑇 𝐶𝐼 = 𝑃 (1 + R )
100 100
P-Principal Amount, R- Rate of interest, T- Time Period
SOURCE CODE
P=int(input("Enter Principal Amount:"))
R=int(input("Enter Rate of Interest:"))
T=int(input("Enter Time Period:"))
sim_interest=(P*R*T)/100
com_interest=P*(1+R/100)**T
print("Simple Interest: ",sim_interest)
print("Compound Interest: ",com_interest)
OUTPUT
Enter Principal Amount:1000
Enter Rate of Interest:8
Enter Time Period:3
Simple Interest: 240.0
Compound Interest: 1259.7120000000002
PROGRAM - 4
POSITIVE/ NEGATIVE/ ZERO
AIM
Write a python program to check whether the given number is positive, negative or zero
using simple if.
SOURCE CODE
a=int(input("Enter a number: "))
if a>0:
print(a," is a positive number")
if a<0:
print(a," is a negative number")
if a= =0:
print(a," is a zero")
OUTPUT
Enter a number: -30
-30 is a negative number
PROGRAM - 5
ELIGIBILITY TO VOTE
AIM
Write a python program to check whether a person is eligible to vote or not with if….else
statement
SOURCE CODE
age=int(input("Enter age: "))
if age>=18:
print("Eligible to vote")
else:
print("Not eligible to vote")
OUTPUT
Enter age: 20
Eligible to vote