模式程序帮助 [英] Pattern Program help

查看:65
本文介绍了模式程序帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我需要使用for循环的for循环嵌套程序的帮助,我正在尝试使用这样的模式:

123456

12345

1234

123

12

1


但是什么时候我试试看,它是这样的:

123456

12345

1234

123

12

1


这是我的计划:

公共课模式{

public static void main(String [] args){


//为行设置


for(int row = 7; row > 1;行 - ){


for(int num = 1; num< row; num ++){


系统。 out.print(num);

}

System.out.println();

}


}


}



有人可以帮帮忙吗?谢谢

解决方案


好​​的,我需要帮助for循环嵌套程序使用for循环,我正在尝试使用这样的图案:

123456

12345

1234

123

12

1


但是当我尝试它时,它是这样的:

123456

12345

1234

123

12

1


这是我的程序:

展开 | 选择 | Wrap | 行号


对不起,它一定输错了,这就是我要找的:

123456


< blockquote class =post_quotes>
对不起,它一定输错了,这就是我要找的:

123456

Ok, I need help on a for loop nested program using for loops, I''m trying to use a patten that goes like this:
123456
12345
1234
123
12
1

but when I try it, it goes like this:
123456
12345
1234
123
12
1

This is my program:
public class Patterns{
public static void main (String [] args) {

//set up for the rows

for(int row = 7 ; row > 1; row--){

for (int num = 1; num < row; num++){

System.out.print(num);
}
System.out.println();
}

}

}


Can anybody help please? thanks

解决方案

Ok, I need help on a for loop nested program using for loops, I''m trying to use a patten that goes like this:
123456
12345
1234
123
12
1

but when I try it, it goes like this:
123456
12345
1234
123
12
1

This is my program:

Expand|Select|Wrap|Line Numbers


I''m sorry, it must have typed it wrong, this is what I''m looking for:

123456


I''m sorry, it must have typed it wrong, this is what I''m looking for:

123456


这篇关于模式程序帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆