C-programming autumn 2008
Excercise 2
MON 15.9 12:15-15:00 BK106
int i; switch(scanf("%d", &i)) { case EOF: printf("see %d\n", i); break; case 1: printf("\tyou"); case 0: printf("\tlater"); break; default: printf("printed %d\ntimes\n", i); }
Write a program that counts the monthly payments of a loan of 210 000 euros,
which has been taken for 20 years and the loan is annuity loan.
This means that the monthly sum of payment is the same.
You can assume that the interest rate is the same during the whole loan period.
The program should count what the monthly payment would be using different
annual interest rate between 3% - 11% using a 1 % interval.
The monthly payment can be counted using the following expression:
monthly payment = r ^ n * p/ (1200 * (r^n -1)) *A, where r = 1 + p/1200 p = annual interest rate (percent), n = the number of months when the loan is paid back, A = the original loan amount ^ means to the power of.To count the power you can use the library function double pow(double x, double y), from the math library (header file is math.h) Use gcc -lm ...
Write a program that counts the average of the student's grades
weighted by the credits. The study information of each student is in a file.
Each line contains one course grade information.
course name credits of the course grade date
C-ohjelmointi 4 3 31052004
The program asks first the name of the file and prints after that
the average of the student's grades
weighted by the credits.
%f %.2f %2.f %10.4f %10.5f %-10.5f %010.5f %-+10.5f %+-10.4f %10.0f
.