Thank you salem and grumpy .
I knew the solution now ..
This is my code
Code:
#include <stdio.h>
#define EMPLOYEE 3
#define SALARY 4
int mean (const int setOfsalarys[],size_t tests);
double total (const int setOfsalarys[],size_t tests);
void printArray(int employee [] [SALARY] ,size_t pupils,size_t tests );
int main(void)
{
size_t employee ;
int employeeSalary[EMPLOYEE][SALARY]=
{ {50, 100, 25, 33}
,{42, 52, 65, 73}
, {89, 44, 17, 18}};
puts("the values in array are :\n");
printArray( employeeSalary , EMPLOYEE , SALARY );
for (employee = 0 ;employee < EMPLOYEE ; ++ employee){
printf("\nthe mean for employee %u is %.2d\n" ,employee ,mean( employeeSalary [employee],SALARY) );
printf("\nthe total for employee %u is %.2f\n" ,employee ,total( employeeSalary [employee],SALARY) );
}
}
int mean (const int setOfsalarys[],size_t tests)
{
size_t k;
int total = 0;
for (k = 0 ; k < tests ; ++k ){
total += setOfsalarys[k];
}
return ( int ) total / tests;
}
double total (const int setOfsalarys[],size_t tests)
{
size_t k;
int total = 0;
for (k = 0 ; k < tests ; ++k ){
total += setOfsalarys[k];
}
return ( double ) total;
}
void printArray(int employee [] [SALARY], size_t pupils, size_t tests )
{
size_t i;
size_t j;
printf("%s"," [0] [1] [2] [3]");
for ( i = 0 ; i < pupils ; ++i) {
printf("\n employeeSalary [%d] ",i );
for ( j = 0 ; j < tests ; ++j) {
printf("%-5d ",employee[ i ][ j ]);
}
}
}