The document contains code snippets for calculating simple interest, converting Celsius to Fahrenheit, finding the average of three numbers, performing arithmetic operations on two numbers, and calculating the area or perimeter of a circle based on the radius. The snippets prompt the user for input, perform calculations, and output results.
The document contains code snippets for calculating simple interest, converting Celsius to Fahrenheit, finding the average of three numbers, performing arithmetic operations on two numbers, and calculating the area or perimeter of a circle based on the radius. The snippets prompt the user for input, perform calculations, and output results.
The document contains code snippets for calculating simple interest, converting Celsius to Fahrenheit, finding the average of three numbers, performing arithmetic operations on two numbers, and calculating the area or perimeter of a circle based on the radius. The snippets prompt the user for input, perform calculations, and output results.
R=float(input('Enter the rate of interest per annum:')) T=float(input('Enter the time in years:')) SI=(P*R*T)/100 amount=SI+P print('Total amount paid:',amount)
# celsius to fahrnheit
celsius = int(input("Enter the Temperature in Celsius :\n"))
fahrenheit = (1.8 * celsius) + 32 print("Temperature in Fahrenheit :", fahrenheit) celsius = int(input("Enter the Temperature in Celsius :\n")) fahrenheit = (1.8 * celsius) + 32 print("Temperature in Fahrenheit :", fahrenheit) celsius = int(input("Enter the Temperature in Celsius :\n")) fahrenheit = (1.8 * celsius) + 32 print("Temperature in Fahrenheit :", fahrenheit)
# average numbers
num_1=float(input("Enter the first number"))
num_2=float(input("Enter the second number")) num_3=float(input("Enter the third number")) avg=(num_1+num_2+num_3)/3 print("The average of three entered numbers is",avg)
#arithmetic operations
num_1=int(input("Enter the first number:"))
num_2=int(input("Enter the second number:")) print("The sum of",num_1,"and",num_2,"gives"num_1+num_2) print("The difference of"num_1,"and",num_2,"gives"num_1-num_2) print("The product of"num_1,"and",num_2,"gives"num_1*num_2) print("The division of"num_1,"and",num_2,"gives"num_1/num_2) print("The modules of"num_1,"and",num_2,"gives"num_1%num_2) print("The floor division of"num_1,"and",num_2,"gives"num_1//num_2) print(num_1,"raised to",num_2,"gives",num_1**num_2)
#area and perimeter of circle
float(input("Enter the radius: "))
print("1.Area of circle") print("2.Perimeter of circle") op=int(input("Choose your option: ")) if op==1: a=3.14*r*r print("Area of the circle with radius",r,"is",a) elif op==2: p=2*3.14*r print("perimeter of the circle with radius,"r,'is',p) else: print("Wrong option")