Tuesday, April 28, 2009

[Java] 簡單程式星星三角形

public class work {
public static int i;
public static void main(String args[]){

String a="*";
System.out.println(a);
for(i=1;i<7;i++){ a="a+">

因為先從基本的開始練習,所以我把我剛練習完成的程式放上來,雖然很簡單不過我會繼續努力的.
如果有更好的寫法,希望可以交流一下,或者是我哪裡寫錯請一定要糾正.謝謝

1 意見:

Xin-Yu Lin said...

Good method. You just use only one for-loop. But what if the output is an inverse triangular tree. How can you implement it?

*****
****
***
**
*

Post a Comment