View Code of Problem 50

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
 int i,j;
 char a[80],b[80];
  gets(a);
 int len=strlen(a);
  for(i=0;i<len;i++)
  {
   if(a[i]>='0'&&a[i]<='9')
     b[j]=a[i];
    putchar(b[j]);
    j++;
  }
  else if(b[j-1]!='*')
  {
   b[j]='*';
    putchar(b[j]);
    j++;
  }
  printf("\n");
  return 0;
}
/*
Main.c: In function 'main':
Main.c:8:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(a);
   ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:17:3: error: 'else' without a previous 'if'
   else if(b[j-1]!='*')
   ^~~~
*/

Double click to view unformatted code.


Back to problem 50