为了账号安全,请及时绑定邮箱和手机立即绑定

自己敲的代码看不懂为什么j是那样子。。。。

#include <stdio.h>
int main()
{
    int i, j, k;
    for(i=1; i<5; i++)
    {
        /* 观察每行的空格数量,补全循环条件 */
        for(    j=i;j<5   ;  j++  )  
        {
            printf(" ");    //输出空格
        }
        /* 观察每行*号的数量,补全循环条件 */
        for( k=0 ;  k<2*i-1 ;  k++     ) 
        {
            printf("*");   //每行输出的*号
        }
        printf("\n");     //每次循环换行
    }
    return 0;
}


正在回答

3 回答

当i=1时,j=i=1,j<5,j++

然后反复循环4次

j一直增加到5的时候不满足条件 不再执行命令,所以第一行得出4个空格,

跳出这一层的for循环。

i=2,........循环3次 得到3个空格........


3 回复 有任何疑惑可以回复我~
#1

张寒拾

哪里是4个空格,第一行是三个啊,用word你打一下
2022-04-04 回复 有任何疑惑可以回复我~
#2

小机灵鬼er 回复 张寒拾

是4个 把输出空格该成0就知道了 ,我也在找为什么j是这样,这个答案是正确的。
2023-07-10 回复 有任何疑惑可以回复我~
https://search.bilibili.com/all? ... F%6C%65%76%6C%68%6C
https://search.bilibili.com/all? ... 4%69%6B%6E%6F%75%76
https://search.bilibili.com/all? ... 7%6E%72%62%63%69%6C
https://search.bilibili.com/all? ... 0%8F%7A%6F%69%62%6C
https://search.bilibili.com/all? ... F%6D%69%61%70%65%67
https://search.bilibili.com/all? ... 0%8F%70%77%71%6B%6B
https://search.bilibili.com/all? ... F%68%62%6A%73%76%79
https://search.bilibili.com/all? ... 5%6D%69%79%63%65%68
https://search.bilibili.com/all? ... F%62%72%77%6D%6F%73
https://search.bilibili.com/all? ... 0%8F%64%62%6B%79%6F
https://search.bilibili.com/all? ... F%6A%79%6E%74%6F%72
https://search.bilibili.com/all? ... F%70%6C%63%66%7A%71
https://search.bilibili.com/all? ... F%7A%69%6B%6D%70%66
https://search.bilibili.com/all? ... 9%70%72%75%78%6D%6F
https://search.bilibili.com/all? ... F%74%6D%75%75%69%6A
https://search.bilibili.com/all? ... B%64%66%77%6B%6D%64
https://search.bilibili.com/all? ... 3%6E%67%6D%65%61%73
https://search.bilibili.com/all? ... C%76%7A%70%6B%61%63
https://search.bilibili.com/all? ... 6%69%6D%64%76%6B%79
https://search.bilibili.com/all? ... 0%8F%72%72%74%69%79
https://search.bilibili.com/all? ... 2%72%67%61%71%72%69
https://search.bilibili.com/all? ... 0%8F%62%63%66%75%78
https://search.bilibili.com/all? ... 4%61%71%67%68%78%66
https://search.bilibili.com/all? ... F%6F%6B%7A%6F%70%71
https://search.bilibili.com/all? ... 0%8F%78%63%77%62%75
https://search.bilibili.com/all? ... 9%76%6C%6D%62%70%72
https://search.bilibili.com/all? ... F%74%6D%64%72%63%71
https://search.bilibili.com/all? ... 0%8F%66%72%67%77%72
https://search.bilibili.com/all? ... 2%6C%6F%64%66%69%77
https://search.bilibili.com/all? ... F%66%75%76%70%63%70
https://search.bilibili.com/all? ... 1%74%7A%63%71%66%69
https://search.bilibili.com/all? ... 8%63%67%61%74%6C%62
https://search.bilibili.com/all? ... 2%73%69%6F%77%64%73
https://search.bilibili.com/all? ... 8%61%62%75%6A%6B%6B
https://search.bilibili.com/all? ... F%6D%63%78%6D%6E%6F
https://search.bilibili.com/all? ... 0%8F%6E%77%6F%65%67
https://search.bilibili.com/all? ... B%63%6C%70%67%78%6F
https://search.bilibili.com/all? ... 7%6D%70%72%6D%6E%70


0 回复 有任何疑惑可以回复我~

因为空格数是4,3,2,1,所以j是这个样子

0 回复 有任何疑惑可以回复我~
#1

qq_慕慕5508019

不是3 2 1?
2022-05-27 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

自己敲的代码看不懂为什么j是那样子。。。。

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信