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

Is the exit() function same as the return statement? Explain.

1155


What is meant by type specifiers?

1180


What is a static variable in c?

1166


Is c is a high level language?

1251


What is #ifdef ? What is its application?

1165


What are the uses of a pointer?

1196


Write a program to print numbers from 1 to 100 without using loop in c?

1134


Explain what are multibyte characters?

1251


what is different between auto and local static? why should we use local static?

1169


Explain the use of 'auto' keyword in c programming?

1180


What kind of structure is a house?

1096


What is the use of sizeof?

1062


Do string constants represent numerical values?

1446


What are different types of pointers?

1105


What is ambagious result in C? explain with an example.

2695