fork download
  1. #include<stdio.h>
  2. void BubbleSort (int arr[], int n)
  3. {
  4. int i, j, temp;
  5. for(i=0; i<n-1; i++)
  6. {
  7. for(j=0; j<n-1; j++)
  8. {
  9. if(arr[j]>arr[j+1])
  10. {
  11. temp=arr[j];
  12. arr[j]= temp;}}}
  13. void print_arrary(int arr[], int size)
  14. {
  15. int i;
  16. for(i=0, i<size; i++)
  17. printf("%d", arr[i]);
  18. int main();
  19. {
  20. int arr[]={20,30,40,50,60,70,80};
  21. int n=size of(arr)/size of (arr[0]);
  22. printf("Unsorted arry:\n");
  23. print-array(arr,n);
  24. bubble-sor (arr,n);
  25. printf("\n sorted arry\n);
  26. return 0
  27. }
  28.  
Success #stdin #stdout 0.02s 25452KB
stdin
Standard input is empty
stdout
#include<stdio.h>
void BubbleSort (int arr[], int n)
{
     int i, j, temp;
     for(i=0; i<n-1; i++)
     {
              for(j=0; j<n-1; j++)
              {
                       if(arr[j]>arr[j+1])
                       {
                                          temp=arr[j];
                                          arr[j]= temp;}}}
                                          void print_arrary(int arr[], int size)
                                          {
                                               int i;
                                               for(i=0, i<size; i++)
                                               printf("%d", arr[i]);
                                               int main();
                                               {
                                                   int arr[]={20,30,40,50,60,70,80};
                                                   int n=size of(arr)/size of (arr[0]);
                                                   printf("Unsorted arry:\n");
                                                   print-array(arr,n);
                                                   bubble-sor (arr,n);
                                                   printf("\n sorted arry\n);
                                                   return 0
                                                   }