fork download
  1. #include <stdio.h>
  2.  
  3. //課題2: 資料のような実行結果になるように空欄を埋めてください
  4.  
  5. void print_number(int n){
  6. printf("%-3d", n);
  7. }
  8.  
  9. void print_star(int n){
  10. print_number(n);
  11.  
  12. //ここから
  13. for(int i = 0; i < n; i++){
  14. printf("*");
  15. }
  16. //ここまでを書けばできます
  17.  
  18. printf("\n");
  19. }
  20.  
  21. int main(void){
  22. int i;
  23.  
  24. for(i = 0; i < 5; i++)
  25. print_star(i);
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
0  
1  *
2  **
3  ***
4  ****