用c语言求1000以内能被7整除 除4余数3并每行输出15个数

如题所述

#include <stdio.h>

int main()
{
    int i, ct = 0;
    for (i = 0; i < 1000; ++i){
        if (i % 7 == 0 && i % 4 == 3){
            if (ct != 0 && ct % 15 == 0)printf ("\n");
            printf ("%d ", i);
            ct++;
        }
    }
    return 0;
}

追问

有点乱

追答

嗯,刚才有点问题,现在好了:

#include <stdio.h>
 
int main()
{
    int i, ct = 0;
    for (i = 0; i < 1000; ++i){
        if (i % 7 == 0 && i % 4 == 3){
            if (ct != 0 && ct % 15 == 0)printf ("\n");
            printf ("%d ", i);
            ct++;
        }
    }
    return 0;
}

追问

谢谢了

追答

还望给个采纳。。。

温馨提示:答案为网友推荐,仅供参考
相似回答