how to break a loop in c
snippet in c

how to break a loop in c

user4256

// The code will print your number 10 times if x <= 100

int x = 120;
for (int i = 0; i < 10; i++)
{
	if (x > 100)
    
		// Note: if multiple for loops: breaks the superficial one
    	break;
    else
	
        printf("%i\n", x);
}