Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,090 --> 00:00:01,420
What is going on, guys?
2
00:00:01,440 --> 00:00:03,540
And welcome back to another example.
3
00:00:03,900 --> 00:00:11,610
And in this video, we're going to write a program that will get two values to inputs from the user.
4
00:00:12,120 --> 00:00:14,280
Let's call it number one and number two.
5
00:00:14,640 --> 00:00:20,670
And then the program will simply display the maximum between these two values.
6
00:00:20,880 --> 00:00:27,900
So simply saying we're going to ask the user to insert two numbers and then we are going to read them
7
00:00:28,260 --> 00:00:32,790
and store them in two variables, let's say number one and number two.
8
00:00:32,970 --> 00:00:39,210
So, for example, if the user said that no one is going to be five and that number two is going to
9
00:00:39,210 --> 00:00:46,470
be seven hours of programming, such a case should just print the following message marks equals to
10
00:00:46,470 --> 00:00:47,160
seven.
11
00:00:47,340 --> 00:00:48,480
Is it OK so far?
12
00:00:48,690 --> 00:00:52,500
Just printing out the highest number between the two.
13
00:00:52,650 --> 00:00:56,040
And basically, you cannot do it without using conditions.
14
00:00:56,340 --> 00:01:03,360
I guess you can try, but most likely you will encounter with some difficulties on the way, which could
15
00:01:03,360 --> 00:01:10,950
be solved very easily using conditions in just the note, guys, that we can not just print on the screen
16
00:01:10,980 --> 00:01:12,030
both numbers.
17
00:01:12,090 --> 00:01:19,140
I mean, we cannot print just five and seven and let the user see both of them and decide for himself.
18
00:01:19,260 --> 00:01:21,360
That's not the goal of this program.
19
00:01:21,360 --> 00:01:23,110
We don't want to print them both.
20
00:01:23,160 --> 00:01:27,030
We just want to print the one with their highest value.
21
00:01:27,150 --> 00:01:33,240
And that's exactly where we need to make some comparison between these two between these two numbers.
22
00:01:33,570 --> 00:01:40,650
And based on the result of this comparison of this condition, we should print the appropriate message
23
00:01:40,650 --> 00:01:41,310
to the screen.
24
00:01:41,490 --> 00:01:47,100
So we need to ask the following question if number one is greater than two.
25
00:01:47,280 --> 00:01:52,650
And if that's the case, meaning give the condition, if the result of the condition is true, then
26
00:01:52,650 --> 00:01:57,900
we should print on the screen max equals and the value of now one.
27
00:01:58,140 --> 00:02:05,940
Otherwise, I mean, else we can conclude that no one is not greater, not higher than NUM two.
28
00:02:06,120 --> 00:02:11,070
So for sure we can say that num two equals or greater than num one.
29
00:02:11,520 --> 00:02:19,950
And we can print the following message marks equals and specify the value of NUM two, which in our
30
00:02:19,950 --> 00:02:21,450
case is simply seven.
31
00:02:21,930 --> 00:02:28,740
So you check the condition if number one is greater than NUM two and based on the result of this condition,
32
00:02:28,800 --> 00:02:35,400
you do, one of the following options is the result of the condition was true.
33
00:02:35,490 --> 00:02:38,630
Then you simply print marks equals two.
34
00:02:38,790 --> 00:02:42,060
Now one is you can see on the left side of this branch.
35
00:02:42,240 --> 00:02:48,630
And if the result of the condition was not true, which means it was false because a condition result
36
00:02:48,900 --> 00:02:51,060
can only be true or false.
37
00:02:51,090 --> 00:02:52,020
It cannot be.
38
00:02:52,090 --> 00:02:52,800
Maybe.
39
00:02:52,800 --> 00:02:54,480
Or a hide and no result.
40
00:02:54,630 --> 00:03:01,830
And if it was false, then we will have to run another code that is associated with this result.
41
00:03:01,860 --> 00:03:08,220
And simply print marks equals to the value of NUM two, which you can see on the right side of this
42
00:03:08,220 --> 00:03:08,910
branch.
43
00:03:09,330 --> 00:03:11,700
So that's easy for these video guys.
44
00:03:11,760 --> 00:03:16,470
And as always, I want to give you as much practice as possible.
45
00:03:16,860 --> 00:03:24,450
So let's take a quick look at the next video where we are going to briefly go over these exercising
46
00:03:24,570 --> 00:03:26,430
our programming language.
47
00:03:26,730 --> 00:03:27,780
So I'll see you there.
4661
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.