TOPIC

wrongAnsware_5%

MdMehediHasan31 asked 6 months ago

What's the problem in this code i get 5% wrong answare. can you tell me the problem?

include include

int main() { int j,h,g,f,i,a,d,l,k,v; char t,num1[1000],num[1000];

while(1)
{
    scanf("%d", &d);
    scanf("%s",num);

    a=strlen(num);

    t=d+48;

    f=0;
    l=0;
    if(num[0]=='0' && t=='0')
    {
        break;
    }
    for(i=0; num[i] != '\0'; i++)
    {

        if(num[i] !=t)
        {

            num1[f] = num[i];
            f++;

        }
        else
        {
            l++;
        }

    }
    if(a==l)
    {
        printf("%c",48);
    }
    if(f>0)
    {
        num1[f]='\0';
    }

    if(num1[0]=='0')
    {
        g=1;
        for(h=g;h<a-1;h++)
        {
            if(num1[h]==48)
            {
                g++;

            }

        }

        if(g==f)
        {

            printf("%c",48);
        }
    }

    else{
            printf("%s",num1);
            num1[0]='\0';
            num1[a]='\0';
    }

}
    return 0;

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • Ashraful Islam Emon replied 1 week ago

    include include

    int main() { int i,j,k,l; char a[10]; char b[1000]; while(scanf("%s%s",a,b)){ if(a[0]=='0'&& b[0]=='0') return 0; j=strlen(b); k=0; l=0; for(i=0;i<j;i++){ if(a[0]!=b[i]){ if(b[i]!='0') k=1; if(k==1){ l=1; printf("%c",b[i]); } } } if(l==0) printf("0"); printf("\n"); } return 0; }

  • MdMehediHasan31 replied 5 months ago

    Hey any body here