标签:stat static string jpg 技术分享 nbsp logs div print
如何用java打印出趣味三角呢?
import java.util.Scanner; public class P1144 { public static void main(String[] args) { int i,j,n,k=1; int a[][]=new int[100][100]; Scanner reader =new Scanner(System.in); n=reader.nextInt(); for(i=1;i<=n;i++){ for(j=1;j<=i;j++){ a[i+1-j][j]=k; k=k+1; } } for(i=1;i<n;i++){ System.out.println(); for(j=1;j<=n+1-i;j++){ System.out.print(" "+a[i][j]); } } } }
标签:stat static string jpg 技术分享 nbsp logs div print
原文地址:http://www.cnblogs.com/boboking/p/7820116.html