#include <stdio.h>
#include <stdlib.h>
int main()
{
int miles,counter;
float gallons;
float average;
counter=0;
while(gallons!=-1){
printf("Enter gallons,(-1 to end):");
scanf("%0.2f",&gallons);
printf("Enter the miles driven:");
scanf("%d",&miles);
if(counter!=0)
average=miles/gallons;
}
printf("The miles/gallons for this tank is %0.2f",average);
return 0;
}
这个老是不能求出来,输入的那个油量和公里最后老是报错,不能得出结果,求各位大神,帮忙看看我while应该输入什么条件去循环