write a program to sort the elements in a given array in c
language
Answer Posted / balaji
#include<stdio.h>
#include<conio.h>
main()
{
int temp,i,j,n=10;
int arr[n];
clrscr();
printf("\n\tEnter The Values into array");
for(i=0;i<n;i++){
printf("\n Enter Element no %d: ",i);
scanf("%d",&arr[i]);}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(arr[j] > arr[j+1]){
temp=arr[j];
arr[j]=arr[j+1];
arr[j]=temp;}
}}
printf("\n-- Sorted Series --");
for(i=0;i<n;i++){
printf("\t %d",arr[i]);}
getch();
}
| Is This Answer Correct ? | 16 Yes | 27 No |
Post New Answer View All Answers
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
Tell me what is the purpose of 'register' keyword in c language?
Why does everyone say not to use scanf? What should I use instead?
Is null a keyword in c?
What are the string functions? List some string functions available in c.
Differentiate between the expression “++a” and “a++”?
When can a far pointer be used?
Explain built-in function?
What are conditional operators in C?
What is gets() function?
How do we print only part of a string in c?
What does. int *x[](); means ?
Differentiate fundamental data types and derived data types in C.
When should a type cast be used?
Why is c called c?