Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,630 --> 00:00:09,180
So in this exercise, what we were requested to do is to find the anthe term, the ends term off an
2
00:00:09,180 --> 00:00:19,080
arithmetic arithmetic sequence, and what we have to do is simply to use the following formula that
3
00:00:19,080 --> 00:00:28,290
says and OK, the end term of this sequence will be equal to a one which is the initial term, plus
4
00:00:28,920 --> 00:00:33,270
and minus one multiplied by the difference.
5
00:00:33,300 --> 00:00:41,730
OK, so what we will simply have to do is to write a simple program that will read as the input all
6
00:00:41,730 --> 00:00:47,070
of these three values, the initial term, the number of elements and the difference.
7
00:00:47,340 --> 00:00:53,520
And based on these terms, we will calculate based on this formula, a mathematical formula.
8
00:00:53,520 --> 00:01:01,770
We will calculate what will be the anthem of this given arithmetic sequence that starts at initial term
9
00:01:01,770 --> 00:01:06,930
of a one with end values and the difference of D..
10
00:01:07,170 --> 00:01:08,220
So let's go.
11
00:01:09,150 --> 00:01:16,210
And the first thing that we have to do is simply create these variables.
12
00:01:16,230 --> 00:01:25,030
So let's assume that we have with that we have both of them, a one in D, both of them are of a floating
13
00:01:25,030 --> 00:01:25,710
coin type.
14
00:01:25,710 --> 00:01:35,940
So float a one and we simply declare them and also we will declare the variable N and the main question
15
00:01:35,940 --> 00:01:42,420
is, should we declare an is an integer or should we declare it is a floating point.
16
00:01:42,450 --> 00:01:46,350
I just like a one in D in the answer is very simple.
17
00:01:46,350 --> 00:01:52,860
We know that N represents the number of elements in a given arithmetic sequence.
18
00:01:53,640 --> 00:01:57,270
So if it represents a given number.
19
00:01:57,300 --> 00:01:57,660
Right.
20
00:01:57,660 --> 00:02:04,350
It's probably going to be of an integer type because there may be two elements, three elements, five
21
00:02:04,350 --> 00:02:05,640
elements, 10 elements.
22
00:02:05,640 --> 00:02:13,950
But chances are not high that there will be two one, two and a half elements or a three in the third
23
00:02:13,950 --> 00:02:14,480
elements.
24
00:02:14,490 --> 00:02:14,800
Right.
25
00:02:15,330 --> 00:02:17,760
That's not something that's going to happen.
26
00:02:17,760 --> 00:02:18,950
So intense.
27
00:02:19,200 --> 00:02:24,840
OK, and now what we are going to do is simply to run these print off-line.
28
00:02:24,840 --> 00:02:29,610
So answer the initial term a one.
29
00:02:29,760 --> 00:02:30,140
Right.
30
00:02:30,150 --> 00:02:37,740
So we will read a one and then we will simply use kind of function to read this value and store it inside
31
00:02:37,740 --> 00:02:38,340
a one.
32
00:02:38,340 --> 00:02:43,620
Variables will present the Jeff because we are using a float type variable.
33
00:02:43,860 --> 00:02:50,990
So it's kind of percentage are in here specifying the address of a one and that's it.
34
00:02:51,540 --> 00:03:00,450
And now once we have a one, we also want to read the value of D, so please answer the difference,
35
00:03:00,840 --> 00:03:07,920
the difference in the arithmetic arithmetic sequence.
36
00:03:07,950 --> 00:03:15,360
OK, so for this given sequence that you want to calculate the end term, insert the difference between
37
00:03:15,510 --> 00:03:24,210
any two consecutive elements, of course use the value from the council using this kind of function
38
00:03:24,420 --> 00:03:27,300
and storage inside of the variable.
39
00:03:28,320 --> 00:03:29,500
OK, is that clearer.
40
00:03:29,520 --> 00:03:31,120
So far, good.
41
00:03:31,410 --> 00:03:39,510
So finally, what we have to do for us to calculate and to use these formula, we know that A1, we
42
00:03:39,510 --> 00:03:40,080
have it.
43
00:03:40,080 --> 00:03:41,600
We also have the difference.
44
00:03:41,820 --> 00:03:48,390
So another thing that we have to know is how many elements are there in this given sequence?
45
00:03:48,790 --> 00:03:55,300
So for that, simply use additional last print F line for reading the information from the user.
46
00:03:55,300 --> 00:04:07,800
Or so panter the number of elements of elements, elements in the RF medic sequence.
47
00:04:09,570 --> 00:04:16,410
So now you have this kind of function and read it using the percentage placeholder and store side variable.
48
00:04:16,410 --> 00:04:24,540
And so the first part of getting all the information necessary to calculate the anthe term of an arithmetic
49
00:04:24,540 --> 00:04:26,490
sequence is now complete.
50
00:04:27,360 --> 00:04:31,980
Now all that remains to do is just to print the result.
51
00:04:32,010 --> 00:04:35,900
OK, so we can simply do it like this.
52
00:04:35,910 --> 00:04:42,280
So print out and use it like at the end of term.
53
00:04:42,790 --> 00:04:45,990
OK, off the arithmetic.
54
00:04:46,350 --> 00:04:54,510
Our arithmetic sequence equals two percentage F backslash and instead of eight percent.
55
00:04:54,550 --> 00:04:59,760
Jeff, what do you think we should use instead of this percentage if it should be a one?
56
00:05:00,250 --> 00:05:00,700
Right.
57
00:05:00,730 --> 00:05:10,810
The value of a one plus and minus one multiplied by the so simply taking these formula and we know that
58
00:05:10,810 --> 00:05:17,050
these formula will give us the value of the ends term and we simply use it here.
59
00:05:17,140 --> 00:05:25,300
And this value that will be calculated from this expression will be placed instead of this percentage
60
00:05:25,510 --> 00:05:29,930
placeholder and the value and the result will be printed to the screen.
61
00:05:30,790 --> 00:05:33,190
So let's just build and run it.
62
00:05:33,640 --> 00:05:37,210
So there you go into the initial theorem, a one.
63
00:05:37,420 --> 00:05:39,040
And previously it was one.
64
00:05:39,430 --> 00:05:43,390
We had a difference between any two neighbors elements.
65
00:05:43,690 --> 00:05:44,440
It was two.
66
00:05:44,710 --> 00:05:49,020
And enter the number of elements in arithmetic sequence.
67
00:05:49,030 --> 00:05:50,650
What was the number of elements?
68
00:05:50,650 --> 00:05:51,900
I think it was nine.
69
00:05:52,360 --> 00:05:53,140
And there you go.
70
00:05:53,410 --> 00:06:00,300
The anthem of the arithmetic sequence equals to 17, just like we had in our example.
71
00:06:01,000 --> 00:06:02,850
So pretty awesome guys.
72
00:06:03,160 --> 00:06:10,090
We also covered some topic from math and we know how to use formulas for math in our programming language.
73
00:06:10,090 --> 00:06:17,260
See, so also, maybe some of you would like to add additional variable and I don't know what to call
74
00:06:17,260 --> 00:06:18,160
it again.
75
00:06:18,220 --> 00:06:21,820
OK, that will represent the theorem.
76
00:06:22,240 --> 00:06:28,840
And just before using these these print off-line are some of my students actually solved this exercise
77
00:06:28,840 --> 00:06:35,320
just like this so and equals two and take all of these expression right from there.
78
00:06:35,320 --> 00:06:35,560
Right.
79
00:06:35,560 --> 00:06:39,600
Because we know that it's kind of exactly our formula.
80
00:06:39,910 --> 00:06:44,860
So instead of this, we will simply use here again and the result is going to be the same.
81
00:06:45,130 --> 00:06:48,370
So one, two and equals like nine.
82
00:06:48,370 --> 00:06:49,450
So seventeen.
83
00:06:49,610 --> 00:06:56,590
And if you would like to know what will be the value in having is a given arithmetic sequence, for
84
00:06:56,590 --> 00:07:02,980
example, if you have one hundred number of elements, so the number is going to be one hundred and
85
00:07:02,980 --> 00:07:03,820
ninety nine.
86
00:07:03,820 --> 00:07:05,210
So awesome.
87
00:07:05,230 --> 00:07:07,300
The formula seems to be working correctly.
88
00:07:09,080 --> 00:07:10,800
And that's it I guess, right.
89
00:07:10,840 --> 00:07:11,070
Yes.
90
00:07:11,290 --> 00:07:13,060
So my name once again.
91
00:07:13,060 --> 00:07:13,990
My name is Lord.
92
00:07:14,120 --> 00:07:17,850
This is Alphatech and thank you so much for watching.
93
00:07:17,860 --> 00:07:18,970
I will see you.
94
00:07:19,030 --> 00:07:21,600
Thank you so much, so much for watching.
95
00:07:21,760 --> 00:07:23,950
And I will see you in the next video.
96
00:07:24,550 --> 00:07:25,860
Have a great day.
9006
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.