c语言求助
#include<stdio.h>main()
{ float value, total, average; int counter;
total=0;counter=0; average = 0;
scanf("%d",&value);
do {
total = total + value; counter++;
scanf ("%f",&value);}
while (value !=-1);
if (counter == 0) printf ("No data entered.\n");
else { average = total / counter;
printf ("The average of %d values is %f",
counter,average);}}
我不理解为什么两个scanf的作用,特别是第一个,求大哥大姐帮帮忙。