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

Popular posts from this blog

Develop and execute C Program to Add Two Distances given in kilometer-meter Using Structures.

Develop a c program to find the sum of all elements stored in a given array using a pointer.