Advertisement
Underhing

ЯВУ. ЛАБ9. ВЕР 1,0

Mar 11th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.  
  6.  
  7. char stroke, b;
  8. int i, linesize ;
  9. printf("ПРОГРАММА ДЛЯ ИЗМЕНЕНИЯ СТРОКИ:\n\n");
  10. printf("Введите длину строки:");
  11. scanf("%d\n",&linesize);
  12. printf("Введите строку:");
  13. scanf("%c\n",&stroke);
  14.  
  15. char a[]={'I','f','w','e','c','a','n','n','o','t','d','o','a','s','w','e', 'w','o','u','l','d','w','e'};
  16.  
  17.  
  18. int N= sizeof(a)/sizeof(a[0]);
  19.  
  20.  
  21. printf("Измененная строка: ");
  22. for (i=0; i<N/2; i++) {
  23. b = a[i];
  24. a[i] = a[N-i-1];
  25. a[N-i-1] = b;
  26. }
  27. for (i=0; i<N; i++) printf("%c",a[i]);
  28.  
  29. printf("\n");
  30.  
  31.  
  32.  
  33.  
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement