Homework 1
The deadline is Sunday, the 15th of November, 23:59 (Estonian time).
The caloric value of food shows how much energy your body gets from the carbohydrates, proteins and fats that the food contains. The file calories.txt contains different meals on separate lines. The number of carbohydrates, proteins and fats is given for each meal in grams. It is known that
- 1 g of carbohydrate gives 4 Kcal,
- 1 g of protein gives 4 Kcal,
- 1 g of fat gives 9 Kcal.
Write a program that calculates and outputs how many calories all meals together give.
If the file calories.txt contains the following lines:
40 53 14 62 47 26 49 43 20 10 35 22
then the output of the program should be
2094
Go to Moodle and upload your solution into Homework 1.