break statement can break any type of loop.
#include<stdio.h>
main(){
int i = 0;
while (1)
{
i = i + 1;
printf(" the value of i is %d\n",i);
if (i>5) {
break;
}
}
}
the value of i is 1
the value of i is 2
the value of i is 3
the value of i is 4
the value of i is 5
the value of i is 6