0
I’m making a code that lists the amount of customers, the type of fuel that each of us fueled, and shows me the percentage of customers who filled each fuel. It’s something very simple, since I’m starting.
My code is like this:
int main() {
int c, g, a;
float Pg, Pa;
printf ("Registro de fim do dia\n");
printf ("\nQuantidade total de clientes hoje: ");
scanf ("%d", &c);
printf ("Quantos abasteceram com gasolina: ");
scanf ("%d", &g);
printf ("Quantos abasteceram com alcool: ");
scanf ("%d", &a);
Pg = (100*g) /c;
Pa = (100*a) /c;
Printf ("\n%.2f dos clientes abasteceram com gasolina\n", Pg);
Printf ("%.2f dos clientes abasteceram com alcool", Pa);
return 0;
}
I am unable to find the error exactly in the code. The error shown in the Registry is:
[Error] Id returned 1 Exit status.
By clicking this error, I am sent to Makefile.win
with that selected line: $(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
.
The C language is case sensitive, the function name is
printf
and notPrintf
. Note that here:Pg = (100*g) /c;
you are doing operations with integers and only in the assignment is that the conversion occurs tofloat
, to do the floating point operation do:Pg = (float)(100*g) / c;
that there the division will be made in floating point. Idem for the calculation ofPa
.– anonimo
It worked perfectly. Thank you <3
– Gabriel Vitor