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
How arrays can be passed to a user defined function
How to throw some light on the b tree?
What are compound statements?
When can a far pointer be used?
Can a file other than a .h file be included with #include?
What are the types of pointers in c?
How do I create a directory? How do I remove a directory (and its contents)?
Can you write the function prototype, definition and mention the other requirements.
What are the types of data types and explain?
How many levels of indirection in pointers can you have in a single declaration?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What does %d do?
all c language question
Which header file is used for clrscr?
What is p in text message?