C语言编程题目:1至100的数,如果能被3整除,请每四个数为一行输出,知道输出所有符合条件的数

如题所述

哈哈,太简单了 so easy
代码如下,测试通过!:
#include<stdio.h>

int main(void)
{
int i,count=0;
for(i=1;i<=100;i++)
{
if(i%3==0)
{
count++;
printf("%d\t",i);
if(count%4==0)
printf("\n");
}
}
printf("\n");
return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-06-28
#include<stdio .h>int main () {int i,k=0; for (i=1;i<=100;i++) if (i%3)==0) {k++; printf("d%\t",i); if ((k%4)==0) printf("\n");} printf("\n press any key to continue ."); return 0;}#include <stdio .h>
int main ()
{int i,k=0;
for (i=1;i<=100;i++)
if (i%3)==0)
{k++;
printf("d%\t",i);
if ((k%4)==0)
printf("\n");}
printf("\n press any key to continue .");
return 0;}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网