View Code of Problem 50

#include<stdio.h>
#include<string.h>

int main(){
	int i,count=0,j=0,w;
	char str1[90],str2[90];
	scanf("%s",str1);

	for(i=0;i<strlen(str1);i++){
		if('0'<=str1[i]&&str1[i]<='9'){
			printf('%c',str1[i]);
		}else(str1[i-1]<'0'||str1[i-1]>'9'){
			printf('*');
		}

	}
	printf("\n");
	return 0;
}
/*
Main.c: In function 'main':
Main.c:11:11: warning: multi-character character constant [-Wmultichar]
    printf('%c',str1[i]);
           ^
Main.c:11:11: warning: passing argument 1 of 'printf' makes pointer from integer without a cast
In file included from Main.c:1:0:
/usr/include/stdio.h:362:12: note: expected 'const char * restrict' but argument is of type 'int'
 extern int printf (const char *__restrict __format, ...);
            ^
Main.c:12:8: warning: statement with no effect [-Wunused-value]
   }else(str1[i-1]<'0'||str1[i-1]>'9'){
        ^
Main.c:12:38: error: expected ';' before '{' token
   }else(str1[i-1]<'0'||str1[i-1]>'9'){
                                      ^
Main.c:6:16: warning: unused variable 'str2' [-Wunused-variable]
  char str1[90],str2[90];
                ^
Main.c:5:20: warning: unused variable 'w' [-Wunused-variable]
  int i,count=0,j=0,w;
                    ^
Main.c:5:16: warning: unused variable 'j' [-Wunused-variable]
  int i,count=0,j=0,w;
                ^
Main.c:5:8: warning: unused variable 'count' [-Wunused-variable]
  int i,count=0,j=0,w;
        ^
*/

Double click to view unformatted code.


Back to problem 50