View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main()
{
  char str1[80],str[80];
  int i,len,j=0;
  gets(str1);
  len=strlen(str1);
  for(i=0;i<len;i++){
     if(str1[i]>='0'&&str1[i]<='9')
        str2[j++]=str1[i];
     else{
        if(str1[i+1]>='0'&&str1[i+1]<='9')
           str2[j++]='*';
      }
    }
  puts(str2);
  return 0;
}
       
       
/*
Main.c: In function 'main':
Main.c:7:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str1);
   ^
Main.c:11:9: error: 'str2' undeclared (first use in this function)
         str2[j++]=str1[i];
         ^
Main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
Main.c:5:17: warning: unused variable 'str' [-Wunused-variable]
   char str1[80],str[80];
                 ^
*/

Double click to view unformatted code.


Back to problem 50