Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. void in(int a[]) {
  3.     int i = 0;
  4.     char c;
  5.     do {
  6.         c = getchar();
  7.         a[i] = (int)c;
  8.         i++;
  9.     } while (c != EOF);
  10. }
  11. int zn(int a[]) {
  12.     int i = 0;
  13.     do {
  14.         i++;
  15.     } while (a[i] != EOF);
  16.     return i;
  17. }
  18. void out(int a[]) {
  19.     for (int i = 0; i < zn(a); i++) {
  20.        if (a[i] == '\n') {
  21.              printf("\\n");
  22.         }
  23.  
  24.         else if (a[i] == '\t') {
  25.              printf("\\t");
  26.         }
  27.            else { printf("%c", a[i]);
  28.         }
  29.     }
  30. }
  31.  
  32. int main() {
  33.     int a[200];
  34.     in(a);
  35.     out(a);
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement