C++ Program to print three numbers in descending order

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int a,b,c,big1,big2,big3;
cout<<“Enter three numbers:”;
cin>>a>>b>>c;


 big1=a;
if(b>big1)
big1=b;
else
if(c>big1)
big1=c;

if(big1==a)
{
if(b>c)
{
big2=b;
big3=c;
}
else
{
big2=c;
big3=b;
}
}

else
{
if(big1==b)
if(a>c)
{
big2=a;
big3=c;
}
else
{
big2=c;
big3=a;
}

else
{
if(a>b)
{
big2=a;
big3=b;
}
else
{
big2=b;
big3=a;
}
}
}
cout<<“nntNumbers in descending order……ntt”;
cout<<big1<<” “<<big2<<” “<<big3;
getch();
}

8 thoughts on “C++ Program to print three numbers in descending order

  1. Neeraj Mishra

    if you want to write programs on my blog than give me your gmail address with which you login to your blogger account…………….i will add you as a writer of my blog……………..

    Reply
  2. Nikhil Ambhorkar

    I wrote cin >> a >> b >> c; instead of cin>>a>>b>>c; Does this affect the output? Because after removing the spaces, my program worked.

    Reply
  3. Priyanshu GTB

    It’s a program which just copied from Sumita Arora C++ Book Class 11.

    Go for some new and Advanced Logic for doing this Program

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.