00:01
Hello, so i'm going to write a program to sort three numbers in and then show them to the user in the sending order.
00:09
So first i'll write some pseudocode to plan out my program.
00:14
So the first step would be obviously to ask the user for the input of the three numbers.
00:21
And now there are a couple of ways that we could go about sorting them.
00:26
I'm going to use a method that will swap the variables so that the smaller numbers.
00:31
Number is on the variable a, the next one will be in b and the third one in c.
00:37
So for example, if the numbers were a equal 50, b, 12, 20, and c equal 40, then after the program runs, the variables will have a equal 30, b equal 40, and c equal 50.
00:56
So to do this, i'm going to first compare a and b if b if i if b then the value in b should be on the variable a so i'm going to swap a and b.
01:11
Swap will mean something like this.
01:17
Temp equal a, v equal a and a equal v and b equal temp.
01:35
Next i need to compare b and c so if b figure out of c, then swap b and c.
01:45
And again, we need to compare a and b again.
01:49
And swap if a is bigger than b.
01:54
Note that because some variables may have been swapped, this comparison is not really the same one as we did before, because the values of the variables could be different...