Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Assignment

1. Write a program that uses input to prompt a user for their name and then welcome them.
Use a variable to store user name. (var_ex1)

Output:

Enter your name: Susan

Hello Susan

2. Write a program that uses input to prompt the user for a Celsius temperature, convert the
temperature to Fahrenheit, and print out the converted temperature. (var_ex2)

Formula: Fahrenheit = (Celsius * 1.8) + 32

Output:

Temperature value in degree Celsius: 37

37 degrees Celsius is equal to 98.60 degree Fahrenheit

3. Write a program that uses input to prompt the user for a radius of circle and then calculate
the area of a circle. (var_ex3)

Formula: area_of_the_circle = pi * radius * radius (pi = 3.14)

Output:

Please enter the radius of the given circle: 3

Area of the circle = 28.26

4. Write a program that uses input to prompt the user for a number and then check the number
is positive, negative or zero number.
Output:

Please enter a number: 0

Zero number

You might also like