im writing a program and im trying to make a sort of loop where if you provided a wrong answer it sends you back to provide the right one

Solution 1:

You want to use a while loop. The loop will continuously run the code inside while the expression Tomatoes != 1 && Tomatoes != 0 evaluates to true.

#include <stdio.h>

int main () {
    int Tomatoes = -1;

    printf(" what would you like as your Toppings?\n");
    printf(" Choose YES(1)  or  NO(0) to select your toppings...\n");

    while (Tomatoes != 1 && Tomatoes != 0) {
        printf(" Tomatoes ? ");
        scanf(" %d", &Tomatoes);
        if (Tomatoes != 1 && Tomatoes != 0) printf(" Invalid choice \n");
    }

    return 0;
}