https://www.cnblogs.com/longhai3/longhai

C语言>>break与continue

Posted on 2022-02-12 19:43  凡是过去,皆为序曲  阅读(56)  评论(0编辑  收藏  举报

100-200素数

#include<stdio.h>
#include<math.h>
int main()
{
int m,a,b;
for(m=100;m<=200;m++)
{
for(a=2;a<=sqrt(m);a++)
{
if(m%a==0)
{break;}
}
if(sqrt(m)<a)
{printf("%d\n",m);}
}
return 0;
}

===========================================================================

continue正数个数

#include<stdio.h>
int main()
{
int a,b,c=0;
for(a=1;a<=10;a++)
{
scanf("%d",&b);
if(b<=0)
{continue;}
c++;
}
printf("%d",c);
return 0;
}

 

随心,随记

https://www.cnblogs.com/w1hg/331817