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