Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,300 --> 00:00:07,230
So let's dive into solving this exercise, so the first thing that we have to do is let's just make
2
00:00:07,230 --> 00:00:12,690
it quick reminder of what we have to do is, for example, if we are getting a three digit number,
3
00:00:12,690 --> 00:00:20,490
so five three one, for example, and what we want to do is simply to print the reverse number to the
4
00:00:20,490 --> 00:00:20,910
screen.
5
00:00:20,920 --> 00:00:24,120
So what we want to be printed is one three five.
6
00:00:24,750 --> 00:00:29,220
And we said that there are two options to solve this exercise.
7
00:00:29,500 --> 00:00:40,940
And one of the options is simply to find the units, to find the tents and also to find the hundreds.
8
00:00:41,340 --> 00:00:49,260
And once we are successful, Honda, hundreds reds and once we've successfully managed to do it, we
9
00:00:49,260 --> 00:00:52,240
can simply print the results to the screen.
10
00:00:52,590 --> 00:00:54,030
So what do we mean by that?
11
00:00:54,480 --> 00:00:57,060
Let's first of all, take a look at this main program.
12
00:00:57,840 --> 00:01:00,830
We create here a new variable called NUM.
13
00:01:01,090 --> 00:01:07,750
OK, we also create three additional variables that will assist us in the solution.
14
00:01:07,770 --> 00:01:16,540
So in units, tens and hundreds, the units will represent the rightmost, the rightmost digit, the
15
00:01:16,560 --> 00:01:24,180
dance will represent the middle digit and the hundreds will represent the hundred digits in these given
16
00:01:24,180 --> 00:01:25,500
three digit number.
17
00:01:25,590 --> 00:01:32,280
OK, so then we are going to print a little nice message for the user through the screen and a three
18
00:01:32,340 --> 00:01:34,040
a three digit number.
19
00:01:34,320 --> 00:01:40,450
We are going to read it using this kind of function in the percentage of the placeholder installed inside
20
00:01:40,450 --> 00:01:48,570
of the address of variable NUM right after words we are going to use units equals to num model 10 to
21
00:01:48,570 --> 00:01:52,560
find the right most digit in this case.
22
00:01:52,770 --> 00:01:53,870
That's how we do it.
23
00:01:53,880 --> 00:01:54,780
We already know it.
24
00:01:54,780 --> 00:01:58,720
By now we find the terms and we find the hundreds.
25
00:01:59,700 --> 00:02:05,490
So what we have here is let's see here is the number, which is five three one.
26
00:02:05,790 --> 00:02:15,240
And also we have the units as one and the ten instance is three and the hundredth is five.
27
00:02:15,690 --> 00:02:24,270
So basically one very simple solution that can be applied for this exercise is simply to print the result.
28
00:02:24,400 --> 00:02:32,850
OK, the reverse number as the following, simply ride the printed function and use higher percentage.
29
00:02:33,180 --> 00:02:43,740
OK, so let's say reverse reverse number, reverse number of percentage, the A's and here use percentage.
30
00:02:43,740 --> 00:02:49,040
The percentage, the percentage then and I will explain right away what exactly do I mean.
31
00:02:49,500 --> 00:02:56,240
So the reverse number of percentage then the first percentage is simply not right.
32
00:02:56,730 --> 00:03:02,720
So that that's what we want to calculate the reverse number for basically to print.
33
00:03:03,060 --> 00:03:07,230
So reverse number of percentage of NUM is OK.
34
00:03:07,260 --> 00:03:11,990
So we want to display on the screen one three five.
35
00:03:12,300 --> 00:03:17,160
So these percentages will be represented by the units.
36
00:03:17,430 --> 00:03:20,340
So units and then the tens.
37
00:03:20,550 --> 00:03:22,540
And then finally the hundreds.
38
00:03:22,770 --> 00:03:31,140
So basically, if we will run this program right now, we know that previously we had like the leftmost
39
00:03:31,140 --> 00:03:32,000
was the 100th.
40
00:03:32,010 --> 00:03:33,720
And in this case it's the units.
41
00:03:34,110 --> 00:03:37,110
The tenth remains in the same position.
42
00:03:37,410 --> 00:03:42,110
And then the hundredth the previous hundredth is going to be now the units.
43
00:03:42,270 --> 00:03:44,570
So we simply switched places.
44
00:03:45,330 --> 00:03:47,730
But let's see what happens.
45
00:03:47,760 --> 00:03:48,980
OK, if we build and run it.
46
00:03:49,110 --> 00:03:57,310
So enter a three digit five three one, the reverse number of five three one is one three five.
47
00:03:57,510 --> 00:03:59,640
OK, so pretty simple.
48
00:03:59,850 --> 00:04:01,400
It seems to be working correctly.
49
00:04:01,410 --> 00:04:02,620
Let's just make sure of it.
50
00:04:03,000 --> 00:04:06,510
So eight, nine, seven, seven, nine, eight.
51
00:04:06,520 --> 00:04:11,280
OK, so the units go to the goes to the hundreds and hundreds goes to the units.
52
00:04:11,280 --> 00:04:14,070
The defense remains in its position.
53
00:04:14,430 --> 00:04:17,940
So everything seems to be working correctly.
54
00:04:18,780 --> 00:04:26,760
But if we wanted to take it even to the next level, because we kind of used here a nice trick to just
55
00:04:26,760 --> 00:04:34,760
print the reversed value, but if we wanted to, let's say, to create a variable that will store it.
56
00:04:35,130 --> 00:04:40,500
So, for example, if we have additional variable called reverse reverse now.
57
00:04:40,860 --> 00:04:43,510
So how basically should we approach it?
58
00:04:44,310 --> 00:04:49,400
We couldn't just take reverse num and say, OK, reverse now equals two.
59
00:04:49,590 --> 00:04:51,090
I don't know, percentage.
60
00:04:51,090 --> 00:04:51,990
The percentage.
61
00:04:52,040 --> 00:04:53,150
The percentage.
62
00:04:53,610 --> 00:04:53,880
Right.
63
00:04:54,420 --> 00:04:57,270
This will be that would be a problem.
64
00:04:57,570 --> 00:04:59,820
Percentage deep and just.
65
00:05:00,100 --> 00:05:00,690
Here, unit.
66
00:05:01,830 --> 00:05:02,850
It simply won't work.
67
00:05:03,300 --> 00:05:09,810
What do we have to do is to apply some sort of mathematical operations and mathematical logic to calculate
68
00:05:09,810 --> 00:05:10,490
the reverse?
69
00:05:10,500 --> 00:05:10,880
None.
70
00:05:11,550 --> 00:05:18,330
So what we know and that's very important to pay really close attention here, guys, because I'm going
71
00:05:18,330 --> 00:05:24,240
to show you how to create these reverse numbers out of these numbers by using these units, tens and
72
00:05:24,240 --> 00:05:33,750
hundreds in the way to do so is simply to understand that the previous units, one should become now
73
00:05:33,750 --> 00:05:35,070
in the reverse number.
74
00:05:35,070 --> 00:05:42,330
It should become the hundreds in the tens should we make tens and hundreds, should become just the
75
00:05:42,330 --> 00:05:45,810
units and how should we basically constructed.
76
00:05:46,320 --> 00:05:48,760
So I want to go with something like this.
77
00:05:48,780 --> 00:05:52,110
OK, so let's just say reverse now equals to zero.
78
00:05:52,890 --> 00:05:58,620
And I will say no, there was not actually there is no need to to nullify it.
79
00:05:58,800 --> 00:06:05,040
So let's just say reverse now equals to what equals two units.
80
00:06:05,380 --> 00:06:10,050
OK, so let's start with the reverse now equals to one in this case.
81
00:06:10,050 --> 00:06:18,990
In our example then what I would like to say is to say reverse now equals to reverse number multiplied
82
00:06:19,170 --> 00:06:20,410
by ten.
83
00:06:20,780 --> 00:06:23,370
OK, plus the tenth.
84
00:06:23,760 --> 00:06:31,080
OK, so I multiply these units by one because I need finally at the end that these units, that these
85
00:06:31,080 --> 00:06:39,450
previous units, it will be multiplied by 100 because it will move from the units in the NUM to the
86
00:06:39,450 --> 00:06:41,040
hundreds in the reverse now.
87
00:06:41,070 --> 00:06:46,530
OK, so one should become one which was units, it should become hundreds in the reverse number.
88
00:06:47,190 --> 00:06:54,150
And what we have to to understand here is that we have the reverse now multiplied by ten.
89
00:06:54,360 --> 00:07:00,870
OK, we will still need to multiply it by another ten to get it, like to be multiplied by one hundred
90
00:07:01,200 --> 00:07:01,980
plus tens.
91
00:07:02,280 --> 00:07:08,270
So it will give us simply one multiplied by ten is ten plus stance, which is three.
92
00:07:08,280 --> 00:07:10,540
It will give us for example, thirteen.
93
00:07:10,860 --> 00:07:16,920
OK, but we are not finished yet because we simply added these tens as a units.
94
00:07:16,920 --> 00:07:17,190
Right.
95
00:07:17,190 --> 00:07:22,300
The three we need to add like 13, OK, to get our final result.
96
00:07:22,770 --> 00:07:27,360
So then we take reverse now equals the reverse.
97
00:07:27,360 --> 00:07:30,000
Now multiply by 10 once again.
98
00:07:30,150 --> 00:07:38,190
That means that the units value the units that we took two lines before will be at the end multiplied
99
00:07:38,190 --> 00:07:39,850
kind of by 800.
100
00:07:40,770 --> 00:07:46,650
And the stance that we took in the previous line on the previous line will be multiplied by ten and
101
00:07:46,650 --> 00:07:48,110
it will be in its right position.
102
00:07:48,300 --> 00:07:55,020
So the units will be kind of treated like hundreds, the will be treated here as tens and we simply
103
00:07:55,020 --> 00:08:01,800
should add the previous hundreds that should be treated in this line, in this reverse number as the
104
00:08:01,800 --> 00:08:02,270
units.
105
00:08:02,550 --> 00:08:04,350
So plus hundreds.
106
00:08:05,460 --> 00:08:11,910
And basically what you will get is the previous reverse number, which is 13 multiplied by ten, which
107
00:08:11,910 --> 00:08:18,660
is one hundred and thirty plus the hundreds, which in these cases five, which is one hundred and thirty
108
00:08:18,930 --> 00:08:27,210
plus five, which gives us a final result of one thirty five, which is exactly the reverse number that
109
00:08:27,210 --> 00:08:29,120
we wanted to find out.
110
00:08:29,400 --> 00:08:35,130
So that was the first option by just printing it, kind of using percentage, the percentage, the percentage
111
00:08:35,490 --> 00:08:38,570
and using the units, the tens and hundreds.
112
00:08:39,390 --> 00:08:47,640
And another option is simply to just print out the reverse number, reversed the number of percentage
113
00:08:47,640 --> 00:08:55,890
P equals two percentage D. And in this case, what we will use here is once again, here is the number
114
00:08:56,340 --> 00:09:00,210
in the new created reverse num variable.
115
00:09:00,960 --> 00:09:07,700
So let's try to build and run it and make sure that the results will be pretty much the same with using
116
00:09:07,920 --> 00:09:12,000
using this additional calculated reverse num or without.
117
00:09:12,240 --> 00:09:13,290
So let's go.
118
00:09:13,290 --> 00:09:15,280
And five three one.
119
00:09:15,300 --> 00:09:17,610
So one three five one three five.
120
00:09:17,640 --> 00:09:21,600
Once again, let's use here on nine, eight, seven.
121
00:09:21,600 --> 00:09:22,920
So seven, eight, nine.
122
00:09:22,920 --> 00:09:27,120
And everything seems to be working just perfect.
123
00:09:28,400 --> 00:09:29,010
Awesome.
124
00:09:29,540 --> 00:09:35,960
So I hope you enjoyed this video that you liked the explanation, if you have any questions, feel free
125
00:09:35,960 --> 00:09:36,710
to ask them.
126
00:09:38,410 --> 00:09:47,180
Also, one last note for this video is that there are kind of plenty of exercises that rely on this
127
00:09:47,180 --> 00:09:55,310
understanding of how to construct these reverse numb, because there may be exercises like write a program
128
00:09:55,310 --> 00:09:58,460
that receives some number from the user.
129
00:09:59,090 --> 00:10:05,720
The program should reverse the number and multiply it by five and multiplied by seven or add something
130
00:10:05,720 --> 00:10:07,310
to it or dividing by something.
131
00:10:07,580 --> 00:10:14,150
So that's something that you could not have used and correctly with this approach, with the first approach
132
00:10:14,150 --> 00:10:19,850
that we use, just the units, tens and hundreds, as just the sequence of integers.
133
00:10:20,570 --> 00:10:27,440
For that, you will have to calculate the actual result in the reverse num variable and then to continue
134
00:10:27,440 --> 00:10:32,450
working with it and to continue applying on its different mathematical operations.
135
00:10:33,170 --> 00:10:35,640
So, guys, this is it for this video.
136
00:10:35,660 --> 00:10:38,000
My name is Vlad, this is Alphatech.
137
00:10:38,120 --> 00:10:47,240
If you want to know more about the cause, the material things we're doing, watch and take a look at
138
00:10:47,240 --> 00:10:48,140
the curriculum.
139
00:10:48,140 --> 00:10:52,520
And also you will know what are the following chapters in these course?
140
00:10:52,550 --> 00:10:55,070
What are the previous chapters?
141
00:10:55,990 --> 00:10:57,130
Basically, this is it.
142
00:10:57,470 --> 00:10:58,780
Thank you so much for watching.
143
00:10:58,820 --> 00:11:00,500
I'll leave it with you.
144
00:11:00,550 --> 00:11:05,560
Feedback and I will see you in the next exercises and then the next sections.
145
00:11:06,140 --> 00:11:07,370
Until then, by.
14132
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.