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. a++;
  12.  
  13. for(i = 0; str[i] != '\0'; i++)
  14. putchar(str[i]);
  15.  
  16. for(; a != 0; a--)
  17. putchar(str[i-1]);
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 1680KB
stdin
5
stdout
最後の文字を何回繰り返しますか?
HelloWorld!!!!!!!