JAVA程序

[复制链接]
查看11 | 回复2 | 2010-1-9 09:37:30 | 显示全部楼层 |阅读模式
import java.math.*
回复

使用道具 举报

千问 | 2010-1-9 09:37:30 | 显示全部楼层
public static void main(String[] args) {for(int i = 1;i<7;i++) { for (int a = 1;a<=i;a++) {
System.out.print(a + " "); } System.out.println();} }
回复

使用道具 举报

千问 | 2010-1-9 09:37:30 | 显示全部楼层
package test02;public class PrintNumber { private int col = 0; //private int row = 3; //此方法根据参数row,灵活的实现行数的输出; public void printNumber(int row) {
for(int i = 1; i <= row; i++) { col++; for(int j = 1; j <= col; j++) {
System.out.print(j); } ;System.out.println();} }}package test02;public class T { /*** @param args*/ public static void main(String[] args) {// TODO 自动生成方法存根PrintNumber p = new PrintNumber();p.printNumber(10); }}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行