View Code of Problem 50

#include<stdio.h>
#include<math.h>
int main(){
 char str1[100],str2[100];
 int i,j,word=0;
 gets(str);
  for(i=0;str1[i]!='\0;i++'){
    if(str1[i]>='0'&&str1[i]<='0'){
    str2[j++]=str1[i];
      word=0;
    }
    else if(word==0){
    str2[j++]='*';
      word=1;
    }
  }
  puts(str2);
}
/*
Main.c: In function 'main':
Main.c:6:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(str);
  ^
Main.c:6:7: error: 'str' undeclared (first use in this function)
  gets(str);
       ^
Main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
Main.c:7:20: warning: character constant too long for its type
   for(i=0;str1[i]!='\0;i++'){
                    ^
Main.c:7:28: error: expected ';' before ')' token
   for(i=0;str1[i]!='\0;i++'){
                            ^
*/

Double click to view unformatted code.


Back to problem 50