進出口新的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);
}
}
}
}
輸出應該是這樣的: '1 *' '2 **' '3 ***' – yakults