新手求个程序

java_age 2010-03-31 10:39:16
使用while 或者do-while打出
*
**
***
****
*****
******
*******
********
**********

刚学,实在弄不出,麻烦高手给个程序,谢谢了
...全文
40 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lishipeng1 2010-03-31
  • 打赏
  • 举报
回复
2楼好像写错了 我验证了 不对的
int i =0 ;
while(i++<10){
int j=0;
while(j++<i){
system.out.print("*");
}
system.out.print("/n");
}
java_age 2010-03-31
  • 打赏
  • 举报
回复
谢谢了.
改成这样System.out.print("\n"); 就是我要的结果了
heruoyong 2010-03-31
  • 打赏
  • 举报
回复
package mars.test;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
int i=0;
while(i++<10)
{
int j=0;
while(j++<i)
{
System.out.print("*");
}
System.out.println("\n");
}

}

}
heruoyong 2010-03-31
  • 打赏
  • 举报
回复
package mars.test;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
int i=0;
while(i++<10)
{
int j=0;
while(j++<i)
{
System.out.print("*");
}
System.out.println("\n");
}

}

}
heruoyong 2010-03-31
  • 打赏
  • 举报
回复
int i=0
while(i++<=10)
{
int j=0;
while(j++<=i)
{
System.out.println("*");
}
System.out.println("\n");
}

50,526

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧