我写的代码,但我不获得最大的价值如何找到最大值寻找最小和最大
#include <stdio.h>
int main(void)
{
double temp[0];
float max,min;
float i;
short c,j,k;
float sum=0;
float nu[c];
printf("Number of values :");
scanf("%f",&i);
for (c=1;i>=c;c++)
{
printf("values=");
scanf("%f",&nu[c]);
nu[c]=temp[0];
for (j = 0; i>=j; j++)
{
if (temp[0]> nu[c])
{
// nu[c]=temp[0];
max = temp[0];
}
}
sum = sum + nu[c];
}
printf("sum = %f \n",sum);
printf("maximum value = %f\n",max);
}
可能重复的[找到sum,min,max与数组](http://stackoverflow.com/questions/3547633/finding-sum-min-max-with-array)(来自同一作者)。 – paxdiablo 2010-08-24 11:16:47