Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  #include <ctype.h>
  3.  #include <malloc.h>
  4.  #define lim 102
  5.  
  6. int main()
  7.   {
  8.       int i,p;
  9.       scanf("%d\n",&p);
  10.       if (p>lim) return 0;
  11.       if (p<0) return 0;
  12.       if (isalpha(p)) return 0;
  13.  
  14.       char c;
  15.      
  16.       char* A =(char*)malloc(p*sizeof(char));
  17.        
  18.       i = 0;
  19.       while (i < p) {
  20.           c = getchar();
  21.           if (c == EOF)
  22.               break;
  23.           if (c == '\n')
  24.               break;
  25.           if(isdigit(c)){
  26.           c = c -'0';
  27.           c = 9 - c;
  28.           c = c + '0';
  29.           }
  30.           A[i++] = c;
  31.       }
  32.       A[i] = '\0';
  33.  
  34.       printf("%s", A);
  35.  
  36.       return 0;
  37.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement