C - Where am I wrong? [Error] Id returned 1 Exit status

Asked

Viewed 30 times

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).

  • 1

    The C language is case sensitive, the function name is printf and not Printf. Note that here: Pg = (100*g) /c; you are doing operations with integers and only in the assignment is that the conversion occurs to float, 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 of Pa.

  • It worked perfectly. Thank you <3

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.