fork(3) download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main(void) {
  4. char k[100];
  5. gets(k);
  6. int lk=strlen(k);
  7. int times;
  8. scanf("%d",&times);
  9. int tl= times*lk;
  10. int i,x=0;
  11. for(i=lk-1;i<tl;i++)
  12. {
  13. k[i+1]=k[x];
  14. x++;
  15. }
  16. for(i=0;i<tl;i++)
  17. {
  18. printf("%c",k[i]);
  19. }
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 2172KB
stdin
hello world 
3
stdout
hello world hello world hello world