View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main()
{
char a[80],b[80];
int x,i=0,j=0;
gets(a);
x=strlen(a);
if(a[i]>=48&&a[i]<=57)
{
b[j]=a[i];
j++;
}
else
{
b[j]='*';
j++;
}
i=1;
while(i<=(x-1))
{
if(a[i]>=48&&a[i]<=57)
{
b[j]=a[i];
j++;
}
else if(b[j-1]!='*')
{
b[j]='*';
j++;
}
i++;
}
b[j]='\0';
puts(b);
}

Double click to view unformatted code.


Back to problem 50