CasperSC
1
Q:

how to break a loop in c

// 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);
} 
4

New to Communities?

Join the community