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 can I read and write comma-delimited text?
What is the difference between #include and #include 'file' ?
What are the different types of endless loops?
What is the significance of scope resolution operator?
Explain the properties of union.
what is the difference between class and unio?
What is abstract data structure in c?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
What are multibyte characters?
Which is better pointer or array?
Explain how can I prevent another program from modifying part of a file that I am modifying?
What is non linear data structure in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Explain data types & how many data types supported by c?