遊客:  註冊 | 登錄 | 幫助





標題: [求助] help me in programming.....
mickeyGoUp     Rank: 7Rank: 7Rank: 7
版主
性別 男
UID 5

精華 0
帖子 35511
積分 5235   詳情

閱讀權限 150
註冊 2006-3-24
來自 美國滴滴尼
狀態 離線

 
 
 
 
發表於 2007-3-15 02:27 AM  資料  個人空間  短訊  加為好友 
If you pay attention, the number of stars on each side is the same number in the middle.  That is, 9 stars, and then the number 9, and then another 9 stars; then next line, 8 stars, and then the number 8, and then 8 stars;...etc..

So you will need a loop that counts from 9 to 1.  And inside, you will use another loop to print the star up to the index of the outer loop.  Then print the outer loop index.  Then another loop to print the star up to the index of the outer loop.

so it will be like:

loop 1 i
   loop 2 j
      print star
   end loop 2
   print i
   loop 3 j
      print star
   end loop 3
end loop 1

頂部

快速美言
           


當前時區 GMT+8, 現在時間是 2024-11-23 06:25 PM

    Powered by Discuz!  © 2001-2007 Comsenz Inc.   
Processed in 0.020299 second(s), 7 queries

清除 Cookies - 聯繫我們 - LIPS Corner 新天藍 - Archiver