View Code of Problem 50

#include<stdio.h>
#include<string.h>
void main()
{
    char str1[100], str2[100];
    int i=0, j=0;
    int isNum = 1;
    gets(str1);
    while(str1[i]!='\0')
    {
        if(str1[i]>=48 && str1[i]<=57)
        {
            str2[j] = str1[i];
            isNum = 1;
            j++;
        }
        else
        {
            if(isNum == 0){

            }
            else {
                str2[j] = '*';
                isNum = 0;
                j++;
            }
        }
        i++;
    }
    printf("%s", str2);
}

Double click to view unformatted code.


Back to problem 50