Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to sort the elements in a given array in c
language

Answer Posted / rajesh evani

#include<stdio.h>
void main()
{
int a[5],t;
int i,j=0;
printf("enter 5 values into the array a");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("the sorted order of elements");
for(i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i<5;i++)
{
printf("%d",a[i]);
}
}

Is This Answer Correct ?    225 Yes 62 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2573


How can you check to see whether a symbol is defined?

1098


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

3111


What are the uses of null pointers?

1100


Explain what are reserved words?

1101


number of times a digit is present in a number

2037


Is main is user defined function?

1139


Difference between goto, long jmp() and setjmp()?

1177


Are negative numbers true in c?

1056


Should I learn c before c++?

1226


Can you please explain the scope of static variables?

1047


Explain how do I determine whether a character is numeric, alphabetic, and so on?

1130


Differentiate between ordinary variable and pointer in c.

1176


What is difference between %d and %i in c?

1232


Differentiate between null and void pointers.

1162