Professional Documents
Culture Documents
Source Code:
def gcd(a,b):
if(b==0):
return a
else:
returngcd(b,a%b)
a=int(input(“Enter first number:”))
b=int(input(“Enter second number:”))
GCD=gcd(a,b)
print(“GCD is: “,GCD)
Test Case – 1
User Output
Enter first number: 12
Enter second number: 6
GCD is: 6
Experiment:8
Write a python script to convert the following using functions:
(i) Fahrenheit to Celsius temperature.
(ii) Celsius to Fahrenheit temperature.
Test Case – 1
User Output
Enter the temperature in celsius or Fahrenheit: 215c
The temperature in Fahrenheit is 419 degrees
b) Write a python program to convert the temperature from Celsius to Fahrenheit
Source code:
celsius = 37.5
fahrenheit = (celsius * 1.8) + 32
print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit' %(celsius,fahrenheit))
Test Case-1
User Output
37.5 degree Celsius is equal to 99.5 degree Fahrenheit