Assignment 1
Assignment 1
OUTPUT:
C=float(input("Enter the
Temperature in celsius: "))
F=(C*9/5)+32
print("The temparature in Fahrenheit
is:", F)
5. Program that asks the user to input a
number and determines whether it is
even or odd
num=int(input("Enter any number:"))
if (num%2)==0:
print("The number is even")
else:
print("The number is odd")
6. Program that swaps the values of two
variables without using a third variable.
import cmath
a=float(input("Enter the coefficient of a:
"))
b=float(input("Enter the coefficient of b:
"))
c=float(input("Enter the coefficient of c:
"))
d=(b**2)-(4*a*c)
sol1=(-b-cmath.sqrt(d))/(2*a)
sol2=(-b+cmath.sqrt(d))/(2*a)
print('The solutions are {0} and
{1}'.format(sol1,sol2))