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