Java作业

package dasd;

import java.util.Scanner;

public class dsa {

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.print("输入一个数字");
int row=sc.nextInt();
int col=sc.nextInt();
star(row,col);
}
public static void star (int x,int y) {
for(int j= 1;j<=x;j++) {
for(int i=1;i<=y;i++) {
System.out.print("*");;
}
System.out.println(" ");
}

}

}

99乘法表

package dasd;

import java.util.Scanner;

public class cfb {

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc= new Scanner(System.in);
System.out.print("输入一个数字");
int n =sc.nextInt();
if(1<=n&&n<=9) {
cfb(n);
}else {
System.out.println("你输入的信息有误");
}
}
public static void cfb(int x) {
for(int i=1 ;i<=x;i++) {

for(int u=1;u<=i;u++) {
System.out.print(i+"*"+u+"="+(i*u)+" ");
}
System.out.println(" ");
}
}

}


Java作业
http://example.com/java作业.html
作者
John Doe
发布于
2021年3月26日
许可协议