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
What does 1f stand for?
Write program to remove duplicate in an array?
What is the use of pointers in C?
What is a macro in c preprocessor?
What are actual arguments?
Explain what are multibyte characters?
What are local variables c?
What are the features of c language?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Write a progarm to find the length of string using switch case?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Explain which function in c can be used to append a string to another string?
Is void a keyword in c?
i got 75% in all semester am i eligible for your company
What are the c keywords?