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

Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

2262


What are the 4 data types?

964


What is LINKED LIST? How can you access the last element in a linked list?

1019


How can you pass an array to a function by value?

1057


What is d scanf?

1027


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2579


What are the __date__ and __time__ preprocessor commands?

1040


What is a example of a variable?

950


What is the code for 3 questions and answer check in VisualBasic.Net?

2101


Explain how can you be sure that a program follows the ansi c standard?

1398


Difference between strcpy() and memcpy() function?

1072


write an algorithm to display a square matrix.

2640


Explain what is the purpose of "extern" keyword in a function declaration?

1029


write a program in c language to print your bio-data on the screen by using functions.

6733


How can I recover the file name given an open stream or file descriptor?

1030