please help me for this program. i'm a beginner. For the below program tell me 
why it doesn't give the right output. Is there any problem in logic or loop i 
given.

please please please help me! :-( :-( :-(








/*write a program to sort five numbers in ascending order*/
/*********************************************************/

#include<iostream.h>
#include<conio.h>
void main()
{
    int array[5],i,j,temp=0;
    clrscr();
    cout<<"Enter any five number:\n";
    for(i=0;i<5;i++)
    {
        cin>>array[i];
    }

    for(i=0;i<5;i++)
    {
        for(j=1;j<5;j++)
        {
            if(array[i]>array[j])
            {
                temp=array[i];
                array[i]=array[j];
                array[j]=temp;
            }
        }
    }

    cout<<"The sorted array is:";
    for(i=0;i<5;i++)
    {
        cout<<"\n"<<array[i];
    }
getch();
}                                         

[Non-text portions of this message have been removed]

Reply via email to