-->

Facebook

Jasper Roberts - Blog

Wednesday, December 21, 2016

Write a C Program to find Gratest of 3 numbers to print the given no in ascending order.

void main()
{
     int a,b,c;
     clrscr();
     printf("enter the values of a,b and c");
    scanf("%d%d%d",&a,&b,&c);

   if(a<b && a<c)
  {
       if(b<c)
  {
       printf(" %d%d%d", a,b,c);
  }
 else if(b>c){
        printf(" %d%d%d",a,c,b);
  }
else if(b<c && b<a)
{
if(c<a)
       printf(" %d%d%d",b,c,a);
else
printf("%d%d%d",b,a,c);
}
else if(b<a)
         printf("%d%d%d",c,b,a);
else
         printf(%d%d%d",c,a,b);
}
}

OUTPUT:
Enter the values of a,b and c
6
4
5
4 5 6