radius=float(input("Enter radius of the circle:")) print("1.calculate area") print("2.calculate perimeter") Choice=int(input("Enter your choice (1or2):")) if choice == 1: area=3.14159*radius*radius print("area of circle with radius", radius,'is',area) else: perm=2*3.14159*radius print ("perimeter of circle with radius", radius,'is',perm) Output Enter radius of circle : 2.5 1.calculate area 2.calculate perimeter Enter your choice(1or 2):1 area of circle with radius 2.5 is 19.6349375
Number 1 : int (input ("Enter first number:")) Number 2 : int (input ("Enter second number:")) remainder = number1%number 2 If remainder == 0 : Print(number1,"is divisible by", number 2) else : Print(number1,"is not divisible by", number 2) Output Enter first number : 119 Enter second number :3 119.0 is not divisible by 3.0 ============================== Enter first number : 119 Enter second number : 17 119.0 is divisible by 17.0
Comments
Post a Comment