C language test the difference between break and continue

C language test the difference between break and continue

1. Enter the code and the result is as follows.

For natural numbers from 1 to 10, break and continue are used in 4 and 5 respectively, and the results are as follows.
Insert picture description here

2. Source code

#include<stdio.h>
void main()
{
    int r;
    float s;
    for(r=1;r<=10;r++)
	{
		s=r;
    if (3<s&&s<6)
		break;
    printf(" %10.6f \n",s);
	}
	printf("  以上显示的是break的结果,下面的是continue的\n");
    for(r=1;r<=10;r++)
	{
		s=r;
    if (3<s&&s<6)
		continue;
    printf(" %10.6f \n",s);
	}
}

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/114806106