Write a program that inputs number of values then inputs these values (double type) one by one in a loop and finally outputs their sum, the maximum value and the minimum value.
Try this...
#include
int main(void)
{
float temp;
int val,i,j,k;
double sum = 0;
double max,min;
printf("Enter the number of values: ");
scanf("%d", &val);
double number[val];
for(i=0; i < val ;i++)
{
printf("enter a value: ");
scanf("%lf", &number[i]);
sum = sum + number[i];
}
min = number[0];
max = number[0];
for(j=0;j max)
max = number[k];
}
printf("Sum = %.lf\n", sum);
printf ("Maximum element: %.f\n",max);
printf ("Minimum element: %.lf\n",min);
}