-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssending_Array.c
More file actions
44 lines (44 loc) · 823 Bytes
/
Assending_Array.c
File metadata and controls
44 lines (44 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Short The Matrix in Assending order
#include<stdio.h>
#include<conio.h>
int main()
{
int arry[100];
int i,j,n,temp;
//Inputing the size of array
printf("Enter the size of array : ");
scanf("%d",&n);
//Inputing Elements of Array
printf("\nEnter Elements : \n");
for(i=0;i<n;i++)
{
printf("No.[%d] : ",i+1);
scanf("%d",&arry[i]);
}
//Printing The Array
printf("The Given Array is : ");
for(i=0;i<n;i++)
{
printf(" %d\t",arry[i]);
}
//Shorting in Assending Order
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(arry[i]>arry[j])
{
temp=arry[i];
arry[i]=arry[j];
arry[j]=temp;
}
}
}
//Printing After Shorting
printf("\nArray After Shorting in Assending Order is : ");
for(i=0;i<n;i++)
{
printf(" %d\t",arry[i]);
}
getch();
}