1)Write the following function: Void spilt _time (long total _sec,int *hr,int in
ID: 3620436 • Letter: 1
Question
1)Write the following function:Void spilt _time (long total _sec,int *hr,int int*min, int *sec), total_sec is a time represented as the number of seconds since midnight>hr,min,and sec are pointers to variable in which the function will store the equivalent time in hours (0-23),minutes(0_59),and seconds (0_59),respectively
Q(2)
The following function supposedly computer the sum and average of the numbers in the array a, which has length n.avgand sum point to variables that the function should modify. The function contains several errors find and correct
Void avg_sum(double a[] , int n , double *sum)
{
Ii int I ;
Sum= 0.0;
For(I = 0; i < n; i++)
Sum += a[i];
Avg = sum / n;
Explanation / Answer
please rate - thanks next time 1 question per post (CRAMSTER rule) I assume the average is also returned void avg_sum(double a[] , int n , double *sum,double *avg){
int i;
*sum= 0.0;
for(i = 0; i < n; i++)
*sum += a[i];
*avg = *sum / n;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.