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 down the program to sort the array.

Answer Posted / anon

#include <stdio.h>

int main() {
int i, j, size, values[100], temp;

printf("Enter the size of an array: ");
scanf("%d",&size);
printf("Enter the values of array: ");
for(i=0;i<size;i++){
scanf("%d",&values[i]);
}

for(i=0;i<size-1;i++){
for(j=i+1;j<size;j++){
if(values[i]<values[j]){
temp=values[i];
values[i]=values[j];
values[j]=temp;
}
}
}
printf("Sorted array:
");
for(i=0;i<size;i++){
printf("%d ",values[i]);
}

return 0;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the condition that is applied with ?: Operator?

1086


What is the difference between ‘g’ and “g” in C?

3931


What does calloc stand for?

1098


What is %d used for?

999


Is linux written in c?

1002


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1168


Explain how many levels deep can include files be nested?

1037


Can a variable be both static and volatile in c?

981


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

2062


What is c language & why it is used?

1047


What is indirection in c?

1033


What are the disadvantages of a shell structure?

1283


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

2164


Define the scope of static variables.

1072


Mention four important string handling functions in c languages .

1054