计算100~200之间不能被3整除的数,continue使用范例

/*输出100~200之间不能被3整除的数*/
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int n,count=0;/*定义变量并将count初始化*/
for(n=100;n<=200;n++)/*确定n的范围并进入for循环*/
{
if(n%3==0) continue;/*如果n能被3整除则退回for语句*/
printf("%5d",n);
count++;/*每增加一个数,count就加1*/
if(count%10==0) printf("\n"); /*每10个数作为一行*/
}
printf("\n");
system("PAUSE");
return 0;
} /*end main*/

 

posted @ 2017-03-22 21:16  HGR  阅读(993)  评论(0编辑  收藏  举报