Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

arrange the elements in array in ascending order using merge sort

0 votes
asked Mar 9, 2018 by Naveen Nicky (120 points)

1 Answer

0 votes
answered May 28, 2018 by dwip neel (190 points)
#include<stdio.h>
#include<conio.h>
main()
{
 int a,b,c;
 clrscr();
 printf("Enter numbers...");
 scanf("%d%d%d",&a,&b,&c);
 if((a>=b)&&(a>=c))
 {
    if(b>=c)
    {
     printf("\n Descending order : %d %d %d",a,b,c);
     printf("\n Ascending order : %d %d %d",c,b,a);
    }
    else
    {
     printf("\n Descending order : %d %d %d",a,c,b);
     printf("\n Ascending order : %d %d %d",b,c,a);
    }
 }
 else if((b>=a)&&(b>=c))
 {
    if(a>=c)
    {
     printf("\n Descending order : %d %d %d",b,a,c);
     printf("\n Ascending order : %d %d %d",c,a,b);
    }
    else
    {
     printf("\n Descending order : %d %d %d",b,c,a);
     printf("\n Ascending order : %d %d %d",a,c,b);
    }
 }
 else if((c>=a)&&(c>=b))
 {
  if(a>=b)
  {
     printf(" Descending order : %d %d %d",c,a,b);
     printf(" Ascending order : %d %d %d",b,a,c);
  }
  else
  {
     printf(" Descending order : %d %d %d",c,b,a);
     printf(" Ascending order : %d %d %d",a,b,c);
  }
}
 getch();
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...