1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <stdio.h>
int main()
{
float mpg[10];
float miles[10]={240.5,300.0,189.6,310.6,280.7,216.9,199.4,160.3,177.4,192.3};
float gallons[10]={10.3,15.6,9.7,14,16.3,15.7,14.9,10.7,9.3,9.4};
for (int i=0;i<10;i++)
{
mpg[i] = miles[i] / gallons[i];
printf("Miles Per Gallon\n");
printf(" %2.1f\n", mpg[i]);
}
return 0;
}
|