#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { char str1[1000],str2[1000]; int i,j,flag; gets(str1); for(i=0,j=0;i<strlen(str1);i++){ if(str1[i]>='0' && str1[i]<='9'){ str2[j++]=str1[i]; flag=0; } else if(flag==0){ str2[j++]='*'; flag=1; } } puts(str2); } |
Double click to view unformatted code.