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
Is the exit() function same as the return statement? Explain.
What is meant by type specifiers?
What is a static variable in c?
Is c is a high level language?
What is #ifdef ? What is its application?
What are the uses of a pointer?
Write a program to print numbers from 1 to 100 without using loop in c?
Explain what are multibyte characters?
what is different between auto and local static? why should we use local static?
Explain the use of 'auto' keyword in c programming?
What kind of structure is a house?
What is the use of sizeof?
Do string constants represent numerical values?
What are different types of pointers?
What is ambagious result in C? explain with an example.