C Program for loop: "Break statement using for loop" with output
#include <stdio.h>
int main() { int i; for (i = 1; i <= 10; i++) { if (i == 5) { printf("Breaking the loop at i = 5\n"); break; // This will exit the loop when i is 5 } printf("i = %d\n", i); } return 0; }i = 1
i = 2
i = 3
i = 4
Breaking the loop at i = 5
Comments
Post a Comment