ProAnswers.org

Write a C program to perform sorting the elements in an array?

#include

#include 

void main() 

{ 

int num[20],j,k,n,s=0; 

clrscr(); 

printf(“enter the number of elements

”);

scanf(“%d”,&n); 

printf(“enter the elements of array

”);

for(j=0;j

{ 

scanf(“%d”,&num[j]); 

s=s+num[j]; 

} 

for(k=0;k

{ 

for(j=0;j

{ 

if(num[j]==k) 

printf(“%d”,num[j]); 

} 

} 

getch(); 

} 

Output: 

enter the number of elements 

3 

5 

3 

8 

3 5 8