Following is sample output when the input values are 3,4,5 3,5,6 5,12,13 6,12,14 0,1,1.
3, 4 and 5 form a right triangle.
3, 5 and 6 do NOT form a right triangle.
5, 12 and 13 form a right triangle.
6, 12 and 14 do NOT form a right triangle.
0, 1 and 1 form a right triangle.
void testTheorem(int a, int b, int c ) { if((( a * a ) + ( b * b )) == ( c * c )) printf("%d, %d and %d form a right triangle.\n", a, b, c ); else printf("%d, %d and %d do NOT form a right triangle.\n", a, b, c ); }
Exercise 3: Car parking fees
Write a C program that has at least one user defined function to calculate car parking fees according to the following schedule of rates:
Weekday rates
First 2 hours is £5.00 per hour
Each hour after the first 2 hours is £4.50 per hour
Weekend rates
First 2 hours is £4.50 per hour
Each hour after the first 2 hours is £4.25 per hour
The program should accept integer input values as comma separated pairs:
number of minutes
1 for weekday rates and zero for weekend rates
Following is sample output when the input values are 90,1 90,0 300,1 300,0 302,1 302,0 0,1.
The parking fee is £9.00 for 90 minutes using weekday rates
The parking fee is £8.50 for 90 minutes using weekend rates
The parking fee is £23.50 for 300 minutes using weekday rates
The parking fee is £21.75 for 300 minutes using weekend rates
The parking fee is £28.00 for 302 minutes using weekday rates
The parking fee is £26.00 for 302 minutes using weekend rates