我是 Java 新手,我想知道是否可以在数字旁边加上星号,例如:1* 2** 3***
我这里有我的代码
package ReviewExercise;
import java.util.Scanner;
public class review1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.print("Enter number from 1 - 10: ");
int num = sc.nextInt();
//for(int r = 1; ; r++){
for(int c = 1; c <= num; c++) {
for (int r = c; r <= c; r++) {
System.out.println(c);
}
}
}
}