C language is a building block for many other currently known languages. C language has variety of data types and powerful operators. Due to this, programs written in C language are efficient, fast and easy to understand.
Array in C are user defined variables that are used to store multiple values in a single variable.
Since, we have to enter ten numbers of same data type, we can use array to store them and with the help of for loop, we can store, sort and display them.
Here is the program,
#include<stdio.h>
int main()
{
int arr[10],i,j,temp;
printf("Enter any ten integer numbers\n");
for(i=0;i<10;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<9;i++)
{
for(j=i+1;j<10;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
printf("The numbers in ascending order is \n");
for(i=0;i<10;i++)
print("%d\t", arr[i]);
return 0;
}
The output will be :
Enter any ten integer numbers:
1
3
2
1
4
6
4
8
9
3
The numbers in ascending order are :
1
1
2
3
3
4
4
6
8
9
You can type C code and run the program from this link