Then the algoritm is :-
STEP1 : START.
STEP2 : A=10.
STEP3 : B=02.
STEP4 : C=A-B.
STEP5 : PRINT C.
STEP6 : STOP.
AnswerYou cannot print every even number in descending order, because there is no greatest even number. Or you want something like this:infinity
infinity-2
infinity-4
Answerstep 1: startstep 2: Input N
step 3: If N<=1, go to step 5
step 4: if N%2=0, Print N
N=N-1, go to step 3
step 5: End
Chat with our AI personalities
In Maths, we often talk about ascending and descending order. Ascending order is writing numbers from smallest to largest. Descending order is writing numbers from largest to smallest.
Change every "<" to ">" and ">" to "<" .
Make use of Java's robust library: // filled with various ints int[] a; // temporary variable for swapping values int temp; // sort with fast, built-in algorithm java.util.Arrays.sort(a); // reverse the array for( int i = 0; i < a.length/2; ++i ) { temp = a[i]; a[i] = a[a.length - i - 1]; a[a.length - i - 1] = temp; } Obviously, if you're concerned with execution speed you could write your own sort method which would sort into descending order instead of ascending order (perhaps by modifying Java's sort algorithm).
sorting means arranging a list of numbers or elements in an order (ascending or descending).
Use a looping structure. The first step initialises a loop control variable, n, to zero. You then begin the loop by processing the nth element from the array (the process may be a simple print statement). You then increment n. Finally, you test the value of n; if it is less than 10 you start a new iteration of the loop, otherwise you proceed to the end of the flowchart.