Programming Questions and Exercises : Input Output

Question 1.

Area and Circumference of Circle
Write a program that inputs from the user the radius of a circle as an integer and prints the circle’s circumference and area using the predefined constant Math.PI. Use the following formulas (r is the radius):
circumference = 2πr
area = πr2

 

Question 2.

Area of Triangle
If a triangle has side lengths a,b,c, then the formula for the area of the triangle is area = √s(s − a)(s − b)(s − c), where s = (a + b + c)/2.
Write a program that asks the user to enter three sides of triangle. The program should compute and display the area of triangle.

 

Question 3.

Celsius to Fahrenheit
Write a program that asks for a temperature in Celsius and prints out the temperature in Fahrenheit. Use InputBox for input and OutputBox for output. The formula to convert Celsius to the equivalent Fahrenheit is:
fahrenheit = 1.8 x celsius + 32

The output should look like:

Celsius to Fahrenheit

 

Question 4.

Wall Painting Calculator
Write a program that when complete will calculate the amount of paint needed to paint the walls and the ceiling of a room. Your program should ask length, width, and height of room. Assume that the room has doors and windows the don't need painting. Also the floor in the room is not painted. Ask the user to enter the number of doors and number of windows in the room, and adjust the total square feet to be painted accordingly. Assume that each door is 20 square feet and each window is 15 square feet.
Suppose the paint covers 350 square feet per gallon.

 

Question 5.

PigLatin Word
Write a program that reads a word as input and converts that word to "Pig Latin". In this version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word. Here is an example:
English Word: night
Pig Latin Word: ightnay

 

Question 6.

Hours, Minutes and Seconds
Write a program that asks the user to enter seconds as integer. The program should compute and display the number of hours, number of minutes and number of seconds in that seconds.
For example if user enters 4205 seconds. The answer should be
Hours : 1
Minutes : 10
Seconds : 5