answersLogoWhite

0

#include <stdio.h>

#include <conio.h>

int main()

{

int a[10],i,j,temp=0;

printf("Enter all the 10 numbers");

for(i=0;i<10;i++)

scanf("%d",&a[i]);

for(i=0;i<10;i++) //This loop is for total array elements (n)

{

for(j=0;j<9;j++) //this loop is for total combinations (n-1)

{

if(a[j]>a[j+1]) //if the first number is bigger then swap the two numbers

{

temp=a[j];

a[j]=a[j+1];

a[j+1]=temp;

}

}

}

printf("The ordered array is");

for(j=0;j<10;j++) //Finally print the ordered array

printf("%d \t",a[j]);

getch();

return 0;

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

What are 3 examples of data being sorted in descending and ascending order?

Any data that is keyed to a numeric or text field may be sorted in ascending or descending order. Data that is keyed to a date may be sorted in chronological order (ascending with oldest first) or reverse-chronological order (descending order with newest first). Data that is keyed to a price may be sorted with most-expensive first (descending order) or least-expensive first (ascending order). Data that is keyed to a weight may be sorted in ascending or descending order of weight. And so on.


You can sort numeric fields in ascending order only?

No. They can be sorted either ways. Ascending or Descending.


Sort array in ascending descending order in python?

Using sorted(array,reverse=True)


What advantages of a sorted list over a linked list?

All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.


What is sorted and unsorted?

Sorted refers to a collection of items arranged in a specific order, typically ascending or descending, based on a particular attribute, such as numerical value or alphabetical order. Unsorted, on the other hand, describes a collection where items are not organized in any specific sequence, making it more challenging to locate or analyze individual elements. The distinction between sorted and unsorted data is crucial in computer science, particularly in algorithms and data management, as it affects efficiency in searching and processing.

Related Questions

Can Data can only be sorted in ascending order.?

No, it can be sorted either in ascending or descending order.


Can Data only be sorted in ascending order?

No, it can be sorted either in ascending or descending order.


What are 3 examples of data being sorted in descending and ascending order?

Any data that is keyed to a numeric or text field may be sorted in ascending or descending order. Data that is keyed to a date may be sorted in chronological order (ascending with oldest first) or reverse-chronological order (descending order with newest first). Data that is keyed to a price may be sorted with most-expensive first (descending order) or least-expensive first (ascending order). Data that is keyed to a weight may be sorted in ascending or descending order of weight. And so on.


You can sort numeric fields in ascending order only?

No. They can be sorted either ways. Ascending or Descending.


Sort array in ascending descending order in python?

Using sorted(array,reverse=True)


What is the difference between ascending and descending order?

Ascending means increasing (usually numbers but could be alphabetic). Descending is the opposite. 81, 121, 100, 169, 11, 9, 14; sorted in ascending order is: 9, 11, 14, 81, 100, 121, 169. The letters Q A B T U Y G H, sorted in descending order are: Y U T Q H G B A


Which of the following columns can be sorted by clicking on the ascending and descending arrows on the column header row?

Effective Date


What is arranges selection in sorted order?

Arranges selection in sorted order means placing elements in ascending or descending order based on a specific key or criteria. This involves selecting elements from a set and arranging them in a specified order, such as numerically or alphabetically.


Can only be sorted in ascending order?

There is nothing that can only be sorted in ascending order - unless the sorting is being done as the data are being generated.


If a list of words is sorted alphabetically in word then it is in blank order?

It will be sorted in ascending order.


What is ascending in Excel?

Ascending is an order in which things can be sorted. Ascending would be going from A to Z or lowest to highest numbers or earliest to latest dates.


What is the use of the SQL sort?

The use of sorting information in SQL is to organize database query results. Typically the data can be sorted in either ascending or descending order. The "Order By" command can be used to sort data in SQL by multiple columns.