Problem 52

3 comments on “Problem 52”


  • shushank

    #Python

    l=list(map(str,input().split(” “)))
    l1=[]
    for i in range(len(l)):
    l1.append(eval(l[i]))
    l1.sort()
    for i in range(len(l1)):
    print(str(l1[i]))


  • Pogakula

    #python3
    def sorting(ar):
    for j in sorted([int(i) for i in ar]):
    print(j,end=’ ‘)
    n=int(input(‘enter the length of the array:\t’))
    li=[]
    for i in range(n):
    inp=str(input(‘enter the numeric string:\t’))
    li.append(inp)
    sorting(li)


  • 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