mercredi 10 novembre 2021

Is this an incorrect layout for nested if?

Sorry if I don't explain my problem very well, English isn't my first language. This IF is part of a do-while loop however once it gets to answer = n1 + n2; the rest of the code in the nested if gets ignored. Any reason why?

 if (answer == 4)
        {
            printf ("%d / %d =\n", n1, n2);
            scanf ("%f", &input);
            answer = n1 / n2;
            if (answer == input)
            {
                printf ("correct");

Aucun commentaire:

Enregistrer un commentaire