program c ******問題

2012-10-29 5:23 am
use for loops to generate the pattern. All * should be printed by a single printf
printf( "*"); 吾該可吾可以教我點寫

(a)
*
**
***
****
*****
******
*******
********
*********
**********

回答 (1)

2012-10-29 1:11 pm
✔ 最佳答案
for (int i=10;i>0;i--){ //created 10 lines start 0 - 10
for (int j=i;j<11;j++){ //number of stars each time and depends on the first loop num
printf("*"); // print the shape...
}
printf("\n"); // finish one print
}

i don't know how to use only 1 printf lol but i used two...


收錄日期: 2021-04-17 02:18:20
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20121028000051KK00684

檢視 Wayback Machine 備份