fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. char str[] = {'H','e','l','l','o','W','o','r','l','d','!','\0'};
  6. int i,a;
  7.  
  8.  
  9. printf("最後の文字を何回繰り返しますか?\n");
  10. scanf("%d",&a);
  11.  
  12. for(i = 0; str[i] != '\0'; i++)
  13. putchar(str[i]);
  14.  
  15. for(; a != 0; a--)
  16. putchar(str[i-1]);
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 1724KB
stdin
5
stdout
最後の文字を何回繰り返しますか?
HelloWorld!!!!!!