A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 迷茫不堪的年纪 金牌黑马   /  2015-9-21 20:14  /  2660 人查看  /  36 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

其中错误千千万哦, 小牛们可以找出多少啊?
1>
***
***
****
*****
目标:使用for 循环打印处以上符号
class ForForTest1
{
public static void main(String[]args)
{
for(ing x=1;x<=5;x++);
{
for(int y=1;y<=x;y++);
}
System.out.print("x="+x);
}
System.out.println();
}
疑问点:当X<=时 ,y是否也是正常<=          ?

2>
*****
****
***
**
*
目标:使用for 循环打印处以上符号
方法1:
class ForForTest2
{
public static void main(String[]args)
{
for(ing x=0;x<5;x++);
{
for(int y=x;y<5;y++);
}
System.out.print("x="+x);
}
System.out.println();


方法2:
class ForForTest3
{
public static void main(String[]args)
{
for(ing x=0;x<5;x++);
{
for(int y=0;y<5;y--);
}
System.out.print("x="+x);
}
System.out.println();

}

3>九九乘法表
1*1=1
1*2=2   以此类推,九九乘法
class ForForTest4
{
public static void main(String[]args)
{
for(ing x=1;x<=9;x++);
{
for(int y=1;y<=x;y++);
}
System.out.print(x+“*”+y“=”x*y"\t");
}
System.out.println();

}
4>
1
12
123
1234
12345
class ForForTest5
{
public static void main(String[]args)
{
for(ing x=0;x<5;x++);
{
for(int y=1;y<=5;y++);
}
System.out.print(y);
}
System.out.println();

}


6>1-10的求和
0+1=1
1+2=3
规律如此
class ForForTest6
{
public static void main(String[]args)
{  int sum=0    //定义不断变化的和
for(ing x=0;x<=10;x++);
{
sum+=sum;
System.out.printlny(“sum=”+sum);
}

}

}

7>1-100 中7的个数
class ForForTest7
{
public static void main(String[]args)
{
int  count=0;
for(ing x=1;x<=100;x++);
{
if(x%7=0)
{
System.out.println("count="+count);
}
}
}
}



8>
*   *   *   *    *
   *    *   *   *
     *    *   *
       *    *
          *
目标:使用for 循环打印处以上符号
class ForForTest8
{
public static void main(String[]args)
{
for(ing x=1;x<=5;x++);
{
for(int y=x;y<x;y++); // 打出空格
{
System.out.print(“ ”)
}
for(int z=x;z<=5;z++)
{
System.out.print(“* ”)//打*
}
System.out.println();

}
}
}


36 个回复

正序浏览

太久以前的没有了意义
回复 使用道具 举报
看啊看啊看
回复 使用道具 举报
QiChen 来自手机 中级黑马 2015-10-17 10:41:54
33#
Hoho,看得头痛,太多了……
回复 使用道具 举报
代码没法看,不过还是给你顶一下。
回复 使用道具 举报
头疼+10086
回复 使用道具 举报
学习了啊啊
回复 使用道具 举报
哈哈。我看的都累,较久之前的了
回复 使用道具 举报
看的头疼。。。。
回复 使用道具 举报
这代码看的真心累...
回复 使用道具 举报
必须的。
回复 使用道具 举报
感觉棒棒的
回复 使用道具 举报
还是小6
回复 使用道具 举报
这排版直接就没有了看的欲望.
回复 使用道具 举报
洋葱头头 发表于 2015-9-22 08:03
发帖时候 上面看工具栏不是有一个工具叫"代码" 吗 就是这个符号   直接插入就可以了  ...

好的 ,谢谢哈
回复 使用道具 举报
迷茫不堪的年纪 发表于 2015-9-21 22:26
嘿嘿, 求教啊。。。。很少发帖

发帖时候 上面看工具栏不是有一个工具叫"代码" 吗 就是这个符号 <>  直接插入就可以了
回复 使用道具 举报
看的费劲
回复 使用道具 举报
脑壳疼。。。。。。。。
回复 使用道具 举报
洋葱头头 发表于 2015-9-21 20:28
能插入代码的 你这排版 根本看不下去

嘿嘿, 求教啊。。。。很少发帖
回复 使用道具 举报

是个循环, 太乱了
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 加入黑马