Colloquium 0
Task1.
Define the function int count_nonzeros(int* tab, int len)
, which returns the number of elements from the tab array that are not zero. The board is len long. (3p.)
Example call:
int data[10]={0.8,0.7,0.6,0.5,0.4};
printf("%d\n", count_zeros(date, 10));
Standard output:
5
Task2.
Define the function float med(float a, float b, float c)
, which will return the middle value of its 3 parameters a, b, c. (2p.)
Example call:
float a=4.5, b=10.5, c=12.2;
printf("%f\n", med(a,b,c));
Standard output:
10.5
Task 3.
Write a program that reads one number n from the user and then prints stars on the console, forming a right triangle with sides of n stars. (3p.)
Sample input:
4
Standard output:
*
**
***
****