0% found this document useful (0 votes)
8 views1 page

Programming Basics: Math & Time Conversions

The document outlines a series of programming tasks involving basic arithmetic operations, temperature conversion, formatted output, area calculation of a circle, unit conversion from centimeters to feet and inches, and time manipulation on a 24-hour clock. Each task specifies input requirements and expected output formats. The tasks are designed to practice fundamental programming concepts and data handling.

Uploaded by

2005sharmanalin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Programming Basics: Math & Time Conversions

The document outlines a series of programming tasks involving basic arithmetic operations, temperature conversion, formatted output, area calculation of a circle, unit conversion from centimeters to feet and inches, and time manipulation on a 24-hour clock. Each task specifies input requirements and expected output formats. The tasks are designed to practice fundamental programming concepts and data handling.

Uploaded by

2005sharmanalin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Input two numbers and work out their sum, average and sum of the squares of the
numbers.
2. Write a program to read a "float" representing a number of degrees Celsius, and print
as a "float" the equivalent temperature in degrees Fahrenheit. Print your results in a
form such as 100.0 degrees Celsius converts to 212.0 degrees Fahrenheit.
3. Write a program to print several lines (such as your name and address). You may use
either several printf instructions, each with a newline character in it, or one printf
with several newlines in the string.
4. Write a program to read a number of units of length (a float) and print out the area of
a circle of that radius. Assume that the value of pi is 3.14159 (an appropriate
declaration will be given you by ceilidh - select setup).
Your output should take the form: The area of a circle of radius ... units is .... units.
If you want to be clever, and have looked ahead in the notes, print the message Error:
Negative values not permitted. if the input value is negative.
5. Given as input a floating (real) number of centimeters, print out the equivalent
number of feet (integer) and inches (floating, 1 decimal), with the inches given to an
accuracy of one decimal place.

Assume 2.54 centimeters per inch, and 12 inches per foot.

If the input value is 333.3, the output format should be:

333.3 centimeters is 10 feet 11.2 inches.

6. Write a program to read two integers with the following significance.

The first integer value represents a time of day on a 24 hour clock, so that 1245
represents quarter to one mid-day, for example.

The second integer represents a time duration in a similar way, so that 345 represents
three hours and 45 minutes.

This duration is to be added to the first time, and the result printed out in the same
notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45.

Typical output might be Start time is 1415. Duration is 50. End time is 1505.

You might also like