package zzz;
public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int b[][] = new int[][]{{1},{1,1},{1,2,1},{1,3,3,1},{1,4,6,4,1},{1,5,10,10,5,1},{1,6,15,20,15,6,1},{1,7,21,35,35,21,7,1},{1,8,28,56,70,56,28,8,1},{1,9,36,84,126,126,84,36,9,1}};
for(int x=0;x<b.length;x++) {
for(int y=0;y<b[x].length;y++) {
System.out.print(b[x][y]);
}
System.out.println();
}
}
}
————————————————
package zzz;
import java.util.Scanner;
public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner sc = new Scanner(System.in);
System.out.println("请输入本班学生总数:");
int studentcout = sc.nextInt();
int achivement[][] = new int[studentcout][4];
for (int i = 0; i < studentcout; i++) {
System.out.println("请输入第" + (i + 1) + "个学生的编号:");
achivement[i][0] = sc.nextInt();
System.out.println("请输入语文成绩:");
achivement[i][1] = sc.nextInt();
System.out.println("请输入数学成绩:");
achivement[i][2] = sc.nextInt();
System.out.println("请输入英语成绩:");
achivement[i][3] = sc.nextInt(); } System.out.println("学生成绩结果如下");
System.out.println("---------------------------------------------");
System.out.println("学生编号\t语文成绩\t数学成绩\t英语成绩\t平均成绩\t总成绩");
for (int i = 0;i < achivement.length; i++) {
double sum = 0;
double ave = 0;
for (int j = 0; j < achivement[i].length; j++) {
System.out.print(achivement[i][j] + "\t");
if (j > 0) {
sum += achivement[i][j];
}
}
ave = sum / 3;
System.out.print(String.format("%.2f", ave) + "\t" + (int) sum + "\n"); }
}
}
————————————————
package zzz;
import java.util.Scanner;
public class Zjy {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int zuo[][] = new int[9][4];
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 4; j++) {
zuo[i][j] = 1;
}
}
while (true) {
System.out.println(" 简单客车售票系统" + "\n 9排4列的大巴车开始售票");
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 4; j++) {
System.out.print(zuo[i][j] + "\t");
} System.out.println();
}
Scanner sc = new Scanner(System.in);
System.out.print("请输入要预定的坐位行号:");
int row = sc.nextInt();
System.out.print("请输入要预定的坐位列号:");
int column = sc.nextInt();
zuo[row - 1][column - 1] = 0;
}