Sort list of 10 numbers.
This post content:-
Algorithm
Flowchart
C code
Output
Pdf notes
Algorithm :-
Step 1:- start.
Step 2:- declare array = int array[MAXSIZE];
And variable= int i, j, num, temp;
Step 3 :- take input of array.
Step 4:- sort arr .
As follow:-
Bubble sorting
for (i = 0; i < num; i++)
{
for (j = 0; j < (num - i - 1); j++)
{
if (array[j] > array[j + 1])
{
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
Step 5 :- Print sorted array.
Step 6:- END.
Flowchart:-
C code:-
Output:-
Try it yourself:-
Comments
Post a Comment