Posts

program to test the divisibility of a number with another number.

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

program to find the multiples of a number ( the divisor) out of given five numbers.

Print ("Enter five numbers below") num1= float (input("First number:")) num2= float (input("Second number:")) num3= float (input("Third number:")) num4= float (input("Fourth number:")) num5= float (input("Fifth number:")) divisor= float (input("Enter divisor number:")) Count=0 print("Multiples of",divisir, "are:") remainder=num1%divisor if remainder ==0:       print(num1,sep=" ")        Count +=1 remainder=num2%divisor if remainder ==0:       print(num2,sep=" ")        Count +=1 remainder=num3%divisor if remainder ==0:       print(num3,sep=" ")        Count +=1 remainder=num4%divisor if remainder ==0:       print(num4,sep=" ")        Count +=1 remainder=num5%divisor if remainder ==0:       print(num5,sep=" ")        Count +=1 Print() Print(Count,"multiples of",divisor,"found") Output Enter five numbers below First ...

WAP to obtain temperature in Celsius and convert it into Fahrenheit using formula. °C×9/5+32=°F

#celsius to fahrenheit  Cels= float(input("Enter temp in Celsius:")) Print(" Temperature in Celsius is:",Cels) Fahr=Cels×9/5+32 Print("Temperature in Fahrenheit is:",Fahr)

program to calculate BMI (body mass index) of a person.

#to calculate BMI = Kg/m square Weight _in_kg = float (input("Enter weight in kg:")) Height_in_meter = float(input("Enter height in meter :")) Bmi = Weight_in_kg / ( Height_in_meter* Height_in_meter) Print("BMI is:", Bmi) Output Enter weight in kg  : 66 Enter height in meter : 1.6 BMI is : 25.781249999999996

program to obtain three numbers and print their sum.

Image
#to input 3 numbers and print their sum. Num1=int(input("enter number1;")) Num2=int(input("enter number2;")) Num3=int(input("enter number3;")) Sum= Num1+Num2+Num3 Print("Three numbers are:",num1,num2,num3) Print("sum is :",sum)

To find average number in python programming.

# Get three test score round1 = int(input("Enter score for round 1: ")) round2 = int(input("\nEnter score for round 2: ")) round3 = int(input("\nEnter score for round 3: "))     # Calculate the average average = (round1 + round2 + round3) / 3 # Print out the test score print("\nThe average score is: ", average) Output: 4 37 64 Enter score for round 1: Enter score for round 2: Enter score for round 3: The average score is: 35.0

To find area of triangle in python programming

# Find the area of triangle a = 5 b = 6 c = 7 # calculate the semi-perimeter s = (a + b + c) / 2 # calculate the area area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 print('The area of the triangle is %0.2f' %area) Output : The area of the triangle is 14.70