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
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.
What are the 4 data types?
What is LINKED LIST? How can you access the last element in a linked list?
How can you pass an array to a function by value?
What is d scanf?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What are the __date__ and __time__ preprocessor commands?
What is a example of a variable?
What is the code for 3 questions and answer check in VisualBasic.Net?
Explain how can you be sure that a program follows the ansi c standard?
Difference between strcpy() and memcpy() function?
write an algorithm to display a square matrix.
Explain what is the purpose of "extern" keyword in a function declaration?
write a program in c language to print your bio-data on the screen by using functions.
How can I recover the file name given an open stream or file descriptor?