June 3, 2023
Program to use break statement in C Language
#include <stdio.h>
int main()
{
int n;
for (n = 1; n <= 5; n++)
{
if (n == 3)
break;
printf("number=%d\n", n);
}
printf("out of loop\n");
return 0;
}
output
number=1
number=2
out of loop
by : Nadeem Khan
Quick Summary:
Program to use break statement in C Language copy #include <stdio.h> int main() { int n; for (n = 1; n <= 5; n++) { if (n == 3) break; printf(“number=%d\n”, n); } printf(“out of loop\n”); return 0; } output number=1 number=2 out of loop