Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:03,720
All right, guys, so let's get down to business right away.
2
00:00:04,080 --> 00:00:10,890
So we want to write a program that we'll find that we'll find the maximum and the minimum values between
3
00:00:11,130 --> 00:00:12,060
two numbers.
4
00:00:12,090 --> 00:00:12,540
All right.
5
00:00:12,810 --> 00:00:16,980
So, for example, for example, let's make a quick example here.
6
00:00:17,220 --> 00:00:18,870
If we have two numbers.
7
00:00:18,900 --> 00:00:21,480
These numbers should be of a floating point type.
8
00:00:21,600 --> 00:00:27,750
So, for example, the first number is three point five and the second number is 5.2, like you've seen
9
00:00:27,750 --> 00:00:28,410
previously.
10
00:00:28,800 --> 00:00:35,640
Then we want to print a message like this that we want to bring two messages.
11
00:00:35,640 --> 00:00:38,130
Actually, the first one is maximum.
12
00:00:38,390 --> 00:00:39,120
Maximum.
13
00:00:39,810 --> 00:00:41,880
Equals two 5.2.
14
00:00:41,910 --> 00:00:46,950
And the minimum minimum equals two three point five.
15
00:00:47,190 --> 00:00:51,420
So these are these are the two messages that I want to see on the screen.
16
00:00:51,750 --> 00:00:52,170
All right.
17
00:00:52,200 --> 00:00:52,980
So let's go.
18
00:00:53,100 --> 00:01:01,320
First of all, let's remove let's remove these comments and let's create we need to create two variables
19
00:01:01,320 --> 00:01:02,560
of a floating point type.
20
00:01:02,610 --> 00:01:05,790
So we just type float load.
21
00:01:05,940 --> 00:01:06,230
Right.
22
00:01:06,240 --> 00:01:08,670
Float number one and number two.
23
00:01:08,970 --> 00:01:14,970
Then right after we've created them, we will read the values from the user and store them inside of
24
00:01:14,970 --> 00:01:16,660
variables num one and two.
25
00:01:16,670 --> 00:01:17,220
All right.
26
00:01:17,550 --> 00:01:23,940
So print f enter number one, semicolon at the end.
27
00:01:24,090 --> 00:01:30,850
And also we will print the same message for an arm to us or print f enter number two.
28
00:01:32,870 --> 00:01:39,660
And now we are going to read, to read to see is their function scan F to read the value from the console
29
00:01:39,690 --> 00:01:41,730
and storeyed inside of number one.
30
00:01:41,850 --> 00:01:49,200
So for that we are going to use scan F percentage, not D but rather a percentage F because we are using
31
00:01:49,500 --> 00:01:50,760
a floating point type.
32
00:01:50,880 --> 00:01:55,680
And then we are going to specify the address of number one, the address of number one.
33
00:01:56,070 --> 00:01:59,210
And we will do the same also for NUM two.
34
00:01:59,210 --> 00:01:59,740
All right.
35
00:01:59,780 --> 00:02:07,290
So now to scan F percentage F and store the value inside of the variable and two.
36
00:02:07,470 --> 00:02:14,160
And now at this point, we have both of our variables holding two values and we can just print them
37
00:02:14,160 --> 00:02:14,730
right away.
38
00:02:14,730 --> 00:02:15,000
Right.
39
00:02:15,030 --> 00:02:17,490
We cannot print maximum equals two now.
40
00:02:17,490 --> 00:02:20,010
One and or minimum equals two.
41
00:02:20,070 --> 00:02:24,570
Um, two, because we don't know what each variable holds.
42
00:02:24,660 --> 00:02:27,270
Either we say higher or lower number.
43
00:02:27,390 --> 00:02:33,210
So for this, we are going to use a condition that will check which variable number one or number two
44
00:02:33,210 --> 00:02:34,950
holds the higher value.
45
00:02:35,220 --> 00:02:36,300
So it goes like this.
46
00:02:36,630 --> 00:02:42,400
If no one greater than NUM two, then we know for sure who is the maximum.
47
00:02:42,420 --> 00:02:45,430
Between these two numbers and also we know who is the minimum.
48
00:02:45,450 --> 00:02:46,260
Between these two.
49
00:02:46,260 --> 00:02:46,590
Right.
50
00:02:46,620 --> 00:02:53,040
Because either it's one of them is either either is higher than the other one or it's lower.
51
00:02:53,400 --> 00:02:57,810
Basically, we are not taking here the case if both of them are equal.
52
00:02:57,840 --> 00:02:58,320
All right.
53
00:02:58,350 --> 00:03:02,130
We are just leaving it as living it aside for now.
54
00:03:02,250 --> 00:03:05,580
So if that's the case, we are going to open a block of commands.
55
00:03:05,700 --> 00:03:06,120
All right.
56
00:03:06,150 --> 00:03:12,240
An associated block of commands that will be executed if the result of this condition happens to be
57
00:03:12,240 --> 00:03:12,660
true.
58
00:03:12,780 --> 00:03:15,060
So we are going to print two messages here.
59
00:03:15,090 --> 00:03:22,710
The first one is print F and we are going to use maximum value equals two percentage.
60
00:03:22,830 --> 00:03:23,190
F.
61
00:03:23,640 --> 00:03:28,380
Make sure you don't specify here percentage D because we are using a floating point type.
62
00:03:29,090 --> 00:03:31,440
And of course a backslash and at the end.
63
00:03:31,530 --> 00:03:38,130
And we are going to specify here that instead of these percentage F, we are going to use num one because
64
00:03:38,130 --> 00:03:40,170
it's greater than num to end.
65
00:03:40,170 --> 00:03:41,940
It holds the maximum value.
66
00:03:42,450 --> 00:03:45,510
And also we are going to write pretty much the same message.
67
00:03:45,630 --> 00:03:50,130
Just to explain where the minimum is for it.
68
00:03:50,130 --> 00:03:50,940
So minimal.
69
00:03:51,090 --> 00:03:52,350
Equals two percentage.
70
00:03:52,390 --> 00:04:00,450
F also backslash and but now instead of num one, we know that minimum will be in a will be stored in
71
00:04:00,450 --> 00:04:01,770
the variable num two.
72
00:04:02,280 --> 00:04:07,980
So the value is going to be story number two because number two is definitely less than NUM one.
73
00:04:08,250 --> 00:04:12,120
So it will held the minimum value between these two numbers.
74
00:04:12,970 --> 00:04:19,080
And now we should also specify the elf's section, what will happen if the result for this condition
75
00:04:19,230 --> 00:04:20,730
happens to be false.
76
00:04:21,060 --> 00:04:23,100
So here we go again.
77
00:04:23,100 --> 00:04:31,890
We specify that a block of commands and we go to print out that the maximum right now, if this condition
78
00:04:31,890 --> 00:04:39,690
is false, then definitely no one is at least equals to num in Vietnam to at least equals two num one,
79
00:04:40,020 --> 00:04:41,970
or it may be higher than num one.
80
00:04:42,300 --> 00:04:45,200
Then we will assume that maximum is number one.
81
00:04:45,210 --> 00:04:48,480
So percentage f backslash n backslash.
82
00:04:48,730 --> 00:04:57,480
And and if we specify the variable now two and we go the same way, let's copy and paste that, that
83
00:04:57,670 --> 00:04:59,860
the minimum in the.
84
00:04:59,970 --> 00:05:08,670
Case will be won and very know, we can say that we are done with this program.
85
00:05:08,790 --> 00:05:11,100
And if the result of the condition.
86
00:05:11,130 --> 00:05:17,000
Just to summarize it once again, if the result of the condition is false, meaning that no one, no
87
00:05:17,040 --> 00:05:24,570
one was not higher than none to, then we would print we would print the maximum the maximum value of
88
00:05:24,570 --> 00:05:27,720
NUM two and the minimum value of one.
89
00:05:28,090 --> 00:05:31,800
Am just less things to mention here.
90
00:05:31,830 --> 00:05:32,590
No, that's okay.
91
00:05:32,640 --> 00:05:33,390
We talked about it.
92
00:05:33,750 --> 00:05:35,490
So let's just build and run it.
93
00:05:35,580 --> 00:05:41,790
So no one is going to be three point two and number two, he's going to be five point seven, let's
94
00:05:41,790 --> 00:05:42,150
say.
95
00:05:42,870 --> 00:05:48,450
So here we can see maximum equals to five point seven and minimum equals two three point two.
96
00:05:49,290 --> 00:05:56,100
If we tried to do another example, let's say that we use now, one equals to ten point five.
97
00:05:56,550 --> 00:05:59,670
And num two equals to nine point six.
98
00:05:59,700 --> 00:06:05,370
Then we know that the expected maximum value is ten point five and the minimum is nine point six.
99
00:06:05,550 --> 00:06:07,170
So let's see if that's the case.
100
00:06:07,290 --> 00:06:07,680
Yes.
101
00:06:07,680 --> 00:06:13,680
And our program actually finds out exactly what is the maximum and what is the minimum between these
102
00:06:13,680 --> 00:06:14,700
two numbers.
103
00:06:15,120 --> 00:06:20,430
So you've developed a quite a nice program here, and I hope you're proud of yourself.
104
00:06:20,760 --> 00:06:22,500
You keep moving forward.
105
00:06:22,620 --> 00:06:24,330
So that's it for these video guys.
106
00:06:24,330 --> 00:06:25,860
And I'll see you in the next one.
107
00:06:26,250 --> 00:06:27,120
Have a nice day.
9425
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.