Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Problem 52

One comment on “Problem 52”


  • Sadique Gametor

    #include
    #include

    int main()
    {
    char a[100];
    gets(a);
    int l,i,k=0,na[100],j,t;
    for(l=0;a[l];l++);

    for(i=0;i<l;i++)
    {
    if(a[i]=='0' || a[i]=='1' ||a[i]=='2' ||a[i]=='3' ||a[i]=='4' ||a[i]=='5' ||a[i]=='6' ||a[i]=='7' ||a[i]=='8' ||a[i]=='9')
    {
    a[i]=a[i]-48;
    na[k]=a[i];
    k++;
    }
    }

    for(i=0;i<k;i++)
    {
    for(j=i+1;jna[j])
    {
    t=na[i];
    na[i]=na[j];
    na[j]=t;
    }
    }
    }

    for(i=0;i<k;i++)
    printf("%d ",na[i]);
    }

    input:-prep5420insta19
    output:-0 1 2 4 5 9