java函数(练习):打印乘法口诀和矩形
时间:2014-04-23 22:42 来源: 我爱IT技术网 作者:山风
函数(练习)
class Test
{
public static void main(String[] args)
{
draw(3,5);
System.out.println();
print99();
}
//需求1:打印矩形
public static void draw(int row,int col)
{
for(int x=0;x
{
for(int y=0;y
{
System.out.print("*");
}
System.out.println();
}
}
//需求2:打印乘法口诀
public static void print99()
{
for(int x=1;x<=9;x++)
{
for(int y=1;y<=x;y++)
{
System.out.print(y+"*"+x+"="+y*x+"\t");
}
System.out.println();
}
}
}
本文来源 我爱IT技术网 http://www.52ij.com/jishu/5563.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
