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 3

3 comments on “Problem 3”


  • Mohd Saif

    arr=[7,4,5,2]
    for i in range(0,len(arr)):
    for j in range(i):
    if(arr[j]>arr[j+1]):
    temp=arr[j]
    arr[j]=arr[j+1]
    arr[j+1]=temp
    print(arr)


  • Mohd Saif

    arr=[14,33,27,10,35,19,42,44]
    for i in range(0,len(arr)):
    for j in range(i):
    if(arr[j]>arr[j+1]):
    temp=arr[j]
    arr[j]=arr[j+1]
    arr[j+1]=temp
    print(arr)


  • Hritik

    #include
    void bubblesort(int [],int);
    int main(){
    int arr[] = {33,65,23,1,3};
    int i;
    bubblesort(arr,sizeof(arr)/sizeof(arr[0]));
    for(i=0;i<sizeof(arr)/sizeof(int);i++){
    printf("%d\t",arr[i]);
    }
    return 0;
    }
    void bubblesort(int arr[] , int n){
    int i,j,temp;
    for(i=1;i<=n-1;i++){
    for(j=0;jarr[j+1]){
    temp = arr[j];
    arr[j]=arr[j+1];
    arr[j+1]=temp;
    }
    }
    }
    }