View Code of Problem 50

#include <stdio.h>
#include <string.h>
void main()
{
	char str1[100];
  	char str2[100];
  	gets(str1);
 	int i,j=0;
  	int len=strlen(str1);
  	for(i=0;i<len;++i)
        {
        	if(str1[i]>='0'&&str1[i]<='9')
                  str2[j++]=str[i]
                else
                {
                	if(str1[i+1]>='0'&&str1[i+1]<='9')
                        {
                        str[j++]='*';
                        
                        }
                  	if(i==len-1)
                        {
                        	str2[j++]='*';
                        
                        }
                
                
                
                }
        }
  	





puts(str2);


}
/*
Main.c:3:6: warning: return type of 'main' is not 'int' [-Wmain]
 void main()
      ^
Main.c: In function 'main':
Main.c:7:4: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
    gets(str1);
    ^
Main.c:13:29: error: 'str' undeclared (first use in this function)
                   str2[j++]=str[i]
                             ^
Main.c:13:29: note: each undeclared identifier is reported only once for each function it appears in
Main.c:14:17: error: expected ';' before 'else'
                 else
                 ^
*/

Double click to view unformatted code.


Back to problem 50