Advertisement
AJTAMjid2000

Exercise 1.23

Jun 15th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #define Maxline 10000
  4. int main()
  5. {
  6.     int c,i=0;
  7.     char s[Maxline];
  8.     while((c=getchar())!=EOF)
  9.     {
  10.         s[i]=c;
  11.         i++;
  12.     }
  13.     for(i=0;i<strlen(s);)
  14.     {
  15.  
  16.          if(s[i]=='/' && s[i+1]=='*')
  17.         {
  18.             while(s[i]!='*' ||  s[i+1]!='/')
  19.             {
  20.                 i++;
  21.  
  22.             }
  23.             if(s[i]=='*')
  24.             {
  25.                 i++;
  26.             }
  27.         }
  28.          else if(s[i]=='/')
  29.         {
  30.             while(s[i]!='\n')
  31.             {
  32.                 i++;
  33.  
  34.             }
  35.         }
  36.  
  37.         else
  38.         {
  39.             printf("%c",s[i]);
  40.             i++;
  41.         }
  42.     }
  43.  
  44.     return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement