I need help writing this c-program...the code currently prints outthe sum of the
ID: 3618106 • Letter: I
Question
I need help writing this c-program...the code currently prints outthe sum of the arrays and I need to find the minimum value from thelist of inputted numbers. It currently prints out the maximum valuefor some reason...even if I switch theif(x[i]<temp)...Thanks.Also how would I change the program to run it like this....
Write a program to first populate an array of size 11 and then findthe medium of the array elements.
/*
Write a program to first populate an array of size 10 and then findthe minimum number in the array.
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
double x[10];
int i;
double sum = 0;
double temp;
temp = x[0];
for(i=0;i<10;i++){
printf("Enter a number:");
scanf("%lf",&x[i]);
sum += x[i];
if(x[i] > temp)
temp =x[i];
}
printf(" The total number is %3.2f ",sum);
printf("The minimum number is %3.2f ",temp);
system("pause");
return(0);
}