Programming Workshet 4
Programming Workshet 4
Worksheet IV
1. Write a program which converts Celsius degree to Fahrenheit for the range of 10 to
20. The output of the program should be on a file called “result.txt” in the following
format:
2. Write a program which reads text from a file and prints out the content to the screen.
3. Write a program which read 10 real numbers from a file named “input.txt” and
calculate their sum, average, and standard deviation, which will be written in an
external file named “output.txt” in the following format:
The numbers are: 1.35 2.56 3.5 4.0 5.6 6.0 7.6 8.7 9.6 10.5
Sum = 59.41
Average = 5.941
Standard deviation = 3.10718
4. Write a program that reads a text within a file and returns the frequencies of each of
the five vowels it contains. For example, the file may contain:
Civil engineering is a professional engineering discipline that deals with the design,
construction and maintenance of the physical and naturally built environment, including
works such as bridges, roads, canals, dams and buildings.
Output:
The file contains
A: 17 E: 17 I: 23 O: 7 U: 6
5. Write a program that reads text from a file and then prints the number of words that
were read.