0% found this document useful (0 votes)
7 views

Programming Workshet 4

Sgjll

Uploaded by

tadessebirhanu33
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)
7 views

Programming Workshet 4

Sgjll

Uploaded by

tadessebirhanu33
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
You are on page 1/ 1

Worksheets Computer Programming: CEng 2001

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:

Celsius to Fahrenheit conversion table


Celsius Fahrenheit
10 50
11 51.8
12 53.6

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.

AAU,FOT, Department of Civil Engineering Page 1

You might also like