WAP to enter 10 number using array and display it in ascending order

void main()
{
    int no[10],i,j,*temp;
    clrscr();

    printf("enter 10 no:");
    for(i=0;i<=9;i++)
    {
        scanf("%d",&no[i]);
    }

    printf("\nascending:");
    for(i=0;i<=9;i++)
    {
        for(j=0;j<=9;j++)
        {
            if(*(no+i)<*(no+j))
            {
                *temp=*(no+i);
                *(no+i)=*(no+j);
                *(no+j)=*temp;
            }
        }
    }
    for(i=0;i<=9;i++)
    {
        printf("\n%d",no[i]);
    }
    getch();
}
WAP to enter 10 number using array and display it in ascending order WAP to enter 10 number using array and display it in ascending order Reviewed by Unknown on 21:33:00 Rating: 5

No comments:

Powered by Blogger.