Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,640 --> 00:00:05,950
All right, welcome back to another amazing video in our programming course.
2
00:00:06,430 --> 00:00:13,090
Any of these video, what we are going to do is to write an efficient program that receives a number
3
00:00:13,090 --> 00:00:13,990
from the user.
4
00:00:14,140 --> 00:00:23,740
OK, so so far there will be nothing efficient regarding the program, but the efficient path should
5
00:00:23,740 --> 00:00:24,940
come next.
6
00:00:24,970 --> 00:00:33,460
OK, so what the program basically should do, the program should calculate and print the sum of all
7
00:00:33,460 --> 00:00:41,200
the numbers from one up to these, given the number that we receive from the user and we should include
8
00:00:41,200 --> 00:00:49,330
in these some only the numbers that can be divided by three and also can be divided by five.
9
00:00:50,190 --> 00:00:56,820
So let's say that if we take a look, for example, at Naameh, we're now equals to, I don't know,
10
00:00:57,090 --> 00:00:57,990
a hundred.
11
00:00:58,230 --> 00:01:04,740
OK, just just just as an example, then we know that all the numbers from one up to a hundred will
12
00:01:04,740 --> 00:01:05,460
go like this.
13
00:01:05,470 --> 00:01:08,490
So one, two, three, four, five, six.
14
00:01:09,000 --> 00:01:09,420
Right.
15
00:01:09,450 --> 00:01:13,450
So on and so forth on basically up to a hundred.
16
00:01:14,730 --> 00:01:19,950
So what you have to do is to create the sum, probably a variable.
17
00:01:20,370 --> 00:01:24,230
And these sum will contain is part of it.
18
00:01:24,240 --> 00:01:29,550
Just the numbers that can be divided both by three and by five.
19
00:01:30,330 --> 00:01:35,760
So in this case, in this sequence, if we take the value of three, what do you think?
20
00:01:35,760 --> 00:01:37,910
Will it be part of the sum or not?
21
00:01:38,250 --> 00:01:39,830
And also, what about five?
22
00:01:39,840 --> 00:01:41,970
Will it be part of the somewhere or not?
23
00:01:42,690 --> 00:01:49,440
So basically we can say that while three may be divided by three without a remainder, it is definitely
24
00:01:49,440 --> 00:01:51,090
not divisible by five.
25
00:01:51,420 --> 00:01:55,210
And also five can be divided by five, but not by three.
26
00:01:55,680 --> 00:02:00,750
So also, if we have nine, nine can be divided by three, but not by five.
27
00:02:00,750 --> 00:02:02,970
So that's why we don't make it into some.
28
00:02:03,510 --> 00:02:10,170
But one number that we will take is 15, for example, because 15 can be divided both by three, which
29
00:02:10,170 --> 00:02:14,850
will leave us five in both and also by five, which will give us three.
30
00:02:15,450 --> 00:02:23,970
So there are a couple of numbers, a couple of values in these like sequence that may be that can be
31
00:02:23,970 --> 00:02:27,940
actually divided by both three and five.
32
00:02:28,470 --> 00:02:36,090
And what we want to do is to take these numbers, to sum them up and to print the final some of these
33
00:02:36,090 --> 00:02:39,790
numbers from one up to give a given number.
34
00:02:40,620 --> 00:02:46,350
And what do you have to do is, first of all, think of, let's say, the trivial solution with the
35
00:02:46,350 --> 00:02:52,350
basic solution that you would think about just using probably some loop to iterate over all the numbers
36
00:02:52,350 --> 00:02:55,140
and testing out a couple of conditions.
37
00:02:55,740 --> 00:03:03,720
And then you will have to optimize these programming to be efficient, more efficient, at least than
38
00:03:03,750 --> 00:03:07,760
your previous solution, where you checked about two conditions.
39
00:03:08,520 --> 00:03:10,530
So take your time.
40
00:03:10,530 --> 00:03:14,550
Think about the solution, because it's important to come up with two options.
41
00:03:15,000 --> 00:03:19,950
The first option is less optimal in the next one will be more optimized.
42
00:03:20,640 --> 00:03:21,710
And yeah.
43
00:03:21,870 --> 00:03:24,000
So my name is one.
44
00:03:24,090 --> 00:03:25,130
This is Alphatech.
45
00:03:25,290 --> 00:03:27,390
This is our amazing programming course.
46
00:03:27,660 --> 00:03:29,550
And good luck, guys.
47
00:03:29,580 --> 00:03:32,010
LCN in the next video.
4503
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.