Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,810 --> 00:00:07,320
So welcome back and in this exercise, what we are going to do is once again to talk about arithmetic
2
00:00:07,320 --> 00:00:14,490
sequence and basically it's going to be very singular exercise, but just we are going to calculate
3
00:00:14,490 --> 00:00:15,580
something different.
4
00:00:16,080 --> 00:00:22,500
So in this exercise, what you have to do is to write a program that calculates and Prince asks and
5
00:00:22,980 --> 00:00:24,900
basically what is s.m?
6
00:00:25,080 --> 00:00:28,050
It's the sum of a given sequence.
7
00:00:28,090 --> 00:00:36,000
OK, so basically previously we had this sequence as an example and we said that the difference is two,
8
00:00:36,000 --> 00:00:36,530
right?
9
00:00:36,570 --> 00:00:42,260
That's the number, the difference between every two consecutive neighbors.
10
00:00:42,810 --> 00:00:44,910
And also we have the initial theorem.
11
00:00:44,910 --> 00:00:54,330
We had the number of elements in this sequence and we had a and which is the term of these given arithmetic
12
00:00:54,330 --> 00:00:54,840
sequence.
13
00:00:55,500 --> 00:01:03,660
So now what we have to do is previously we had one value, one terminology missing, and we had to use
14
00:01:03,660 --> 00:01:08,520
some formula to find it out to find it through some calculations.
15
00:01:09,240 --> 00:01:19,920
Now, what we will have to do is simply to use some other formula to find out what will be the sum of
16
00:01:19,920 --> 00:01:23,190
all of these elements in a given sequence.
17
00:01:23,550 --> 00:01:28,530
So basically, we could also summarize them just one after another.
18
00:01:28,560 --> 00:01:33,470
So one plus three plus five plus seven plus nine and so on up until 17.
19
00:01:34,050 --> 00:01:41,940
But this approach and this technique probably will won't be good enough if we are required to use it
20
00:01:42,270 --> 00:01:52,590
with the eye to know, for example, the last element will be 999 will be pretty difficult to use it
21
00:01:53,130 --> 00:01:56,050
in in using our calculator.
22
00:01:56,100 --> 00:02:02,820
So for that, what we have to do is to use the following formula that specifies how you can count and
23
00:02:02,820 --> 00:02:06,680
how you can calculate the sum of an arithmetic sequence.
24
00:02:07,350 --> 00:02:08,430
So it goes like this.
25
00:02:08,580 --> 00:02:16,710
The sum equals the sum of an elements equals two with the initial value plus the last value.
26
00:02:16,800 --> 00:02:25,290
OK, the Ethereum multiplied by NP, which is the total number of elements in a given sequence divided
27
00:02:25,290 --> 00:02:25,830
by two.
28
00:02:26,400 --> 00:02:28,390
OK, so that's how you use it.
29
00:02:29,200 --> 00:02:30,480
That's our formula.
30
00:02:30,510 --> 00:02:34,380
That's the formula we are going to use for our calculations.
31
00:02:34,620 --> 00:02:38,970
And of course, once again, we could have done it on a piece of paper.
32
00:02:39,000 --> 00:02:45,760
But now what we have to do is to make it programmatically in our programming language.
33
00:02:46,290 --> 00:02:52,600
So just to show you guys an example so we know SFM equals to this terminology of these formula.
34
00:02:52,860 --> 00:02:59,790
So what will be the sum of these now of this sequence instead of calculating it one by one and adding
35
00:02:59,790 --> 00:03:04,020
the result, it will be as of an equals to one, because that's the initial term.
36
00:03:04,230 --> 00:03:11,640
Alphen, which is the anthem, which is 17 multiplied by an equals two nine nine elements divided by
37
00:03:11,640 --> 00:03:18,720
two, which gives us a total of 18 multiplied by nine, divided by two, which is a total of nine,
38
00:03:18,720 --> 00:03:22,000
multiplied by nine, which is a total of eighty one.
39
00:03:22,500 --> 00:03:28,660
So that will be the sum of all the elements inside of this sequence with nine elements.
40
00:03:29,280 --> 00:03:32,070
So I hope the task is clear to you guys.
41
00:03:32,970 --> 00:03:39,600
Simply write a program that should read from the user and the element, which is an initial theorem,
42
00:03:39,600 --> 00:03:46,900
a one in total terms, and the program should calculate the sum of these given arithmetic sequence.
43
00:03:47,520 --> 00:03:51,510
So give it a try and I will see you in the Solutions video.
4582
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.