c++

	for(int i = 0; i < 10; i++) {
		for(int j = 0; j < 19-i; j++) {
			if (j < i) {
				cout << " ";
				//System.out.print(" ");
			} else {
				//if (j < 19 - 2i){
				cout << "M";
				//System.out.print("M");
			}
		}
		cout << "\n";
	}

打印结果: 

MMMMMMMMMMMMMMMMMMM
 MMMMMMMMMMMMMMMMM
  MMMMMMMMMMMMMMM
   MMMMMMMMMMMMM
    MMMMMMMMMMM
     MMMMMMMMM
      MMMMMMM
       MMMMM
        MMM
          M

posted on 2013-05-08 10:57  snowdrop  阅读(265)  评论(0编辑  收藏  举报