import java.io.*;
public class descendingorder
{
public static void main(String args[]) throws IOException
{
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
int i,j,n,t;
int a[]=new int[20];
System.out.println("Enter the number of elements:");
n=Integer.parseInt(in.readLine());
System.out.println("Enter the elements of the array:");
for(i=0;i<n;i++)
{
a[i]=Integer.parseInt(in.readLine());
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
]
}
}
System.out.println("The orderer lit...");
{
for(i=0;i<n;i++)
{
System.out.println(a[i]);
}
}
}
Write a program to input values into an array and sort the array in descending order. Size of array is 10.
An algorithm to sort a list in ascending order is given below:
for( i = 0 to n-2)
for(j=i+1 to n-1)
if(array[i] > array[j])
swap the values of array[i] and array[j]
ï‚· Array index starts from 0.
ï‚· n is the size of the array
ï‚· Swapping is interchanging the values of two variables. Search the internet for algorithm
to swap the values of two variables.
ï‚· This is bubble sort algorithm
01/* C program to arrange or sort the array in the Descending order */02#include<stdio.h>
03#include<conio.h>
04void main()
05{
06 int ar[100],j,n,i,tmp;
07
08 printf(" Enter the size of the array \t");
09 scanf("%d",&n);
10
11 printf("Now enter the elements in the array \t");
12 for(i=0;i<n;i++)
13 {
14 scanf("%d",&ar[i]);
15 }
16
17 printf("\n Array is - ");
18 for(i=0;i<n;i++)
19 {
20 printf("\t %d",ar[i]);
21 }
22
23 for(i=0;i<n;i++)
24 {
25 for(j=0;j<n-i;j++)
26 {
27 if(ar[j]<ar[j+1])
28 {
29 tmp=ar[j+1];
30 ar[j+1]=ar[j];
31 ar[j]=tmp;
32 }
33 }
34 }
35
36 printf("\n\n Array in the Descending order is - \n");
37 for(i=1;i<=n;i++)
38 {
39 printf("\t %d",ar[i]);
40 }
41 getch();
42}
You cannot arrange an array in two orders at the same time. To arrange them in ascending order, sort the elements using an appropriate sorting algorithm. To reverse the order, work inwards from both ends of the array, swapping the elements as you go.
#include
#include
int main(void)
{
int x; \\ This is the counter variable
int array_var[10]; \\ This is the array
for(x=0; x<10; x++) {
scanf("%d", &array_var[x]);
}
for(x=0; x<10; x++) {
printf("%d\n", array_var[x]);
}
getch();
return 0;
}
Analyze the problem! Do it by your self for you to learn!
-Your computer programming professor
A
Y
Arrange the any one of the order and store the memory in order vice (ie.Ascending for Descending) Then print the second data of that array it is simple way
Arranging 10 numbers in descending orders using C programming language and finding one of them using binary search method is as below: #include void main () { int i,j,a,n,number[30]; printf ("Enter the value of Nn"); scanf ("%d", &n); printf ("Enter the numbers n"); for (i=0; i
step 1:start step 2:input the values of a,b,c step 3:if(a>b&&a>c) max=a step 4:else if(b>c) max=b step 5:else max=c step 6:output:max step 7:stop
Use the std::vector template class (in header <vector>) to store the numbers, then apply the std::vector.sort() algorithm. The default sort order is ascending. The elements must support the less-than operator (<). All the built-in primitives (int, char, double and float) already support this operator.
Ascending order is when numbers are arranged from the smallest to the largest. Descending order is when numbers are arranged from the largest to the smallest.
its arranged by ascending and descending order.........
To sort is to arrange a field(column) depending on whether you choose to have them from lowest to highest or from highest to lowest (ascending or descending)
Example 7, 30, 11, 27, 9, 16,Ascending Order = 7, 9, 11, 16, 27, 30 ( You simply arrange the number from lowest to highest number )Descending Order = 30, 27, 16, 11, 9, 7 ( You simply arrange the number from highest to lowest number )
draw a flow chart to arrange 3 numbers in ascending order
descending
# You can sort data in ascending order depending on the desired requirements # You can also sort data in descending order depending on the application package your using 2b hb 3b b h 3h
addends
Steps:1.) Arrange the data either ascending or descending order of their values.2.) Determine the total number of observations, say n.3.) If the set of number is odd then the middle number will be the median. And if the set of number is even then mean of middle two numbers will be the median.a.) After that we'll be starting to discuss and give examples on how to find the median of ungrouped data.Example1:1.) Find the median of 12, 15, 10, 18, 8.2.) Arrange the data either ascending or descending order of their values.8, 10, 12, 15, 18(ascending)18, 15, 12, 10, 8(descending)3.) If the set of numbers is an odd integer, find the middle number in the set of numbers.From the above middle number 12 then 12 is the median.Example2:1.) Find the median of 23, 46, 18, 32, 65, 20.2.) Arrange the data either ascending or descending order of their values.18, 20, 23, 32, 46, 65(ascending)65, 46, 32, 23, 20, 18(descending)3.) If the set of numbers is an even integer, find the two middle numbers in the set of numbers.From the above we can say that there are two middle numbers23 and 32. So,Md = 23+32/2 = 27.5By: HuebosFb: Jupete02@yahoo.comTwitter: @kimjupetehuebos
Things can be put alphabetical order, numerical Order, date order and so on. Things can be put in ascending or descending order. You can also say that it arranges data in columns, if you take another perspective on your question.
this question is not soluble.the information given reduces the no. of candidates from 9999 to 900 but cant get closer than that
sorry