Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So welcome back and in this exercise, what we are going to do is once again to talk about arithmetic
sequence and basically it's going to be very singular exercise, but just we are going to calculate
something different.
So in this exercise, what you have to do is to write a program that calculates and Prince asks and
basically what is s.m?
It's the sum of a given sequence.
OK, so basically previously we had this sequence as an example and we said that the difference is two,
right?
That's the number, the difference between every two consecutive neighbors.
And also we have the initial theorem.
We had the number of elements in this sequence and we had a and which is the term of these given arithmetic
sequence.
So now what we have to do is previously we had one value, one terminology missing, and we had to use
some formula to find it out to find it through some calculations.
Now, what we will have to do is simply to use some other formula to find out what will be the sum of
all of these elements in a given sequence.
So basically, we could also summarize them just one after another.
So one plus three plus five plus seven plus nine and so on up until 17.
But this approach and this technique probably will won't be good enough if we are required to use it
with the eye to know, for example, the last element will be 999 will be pretty difficult to use it
in in using our calculator.
So for that, what we have to do is to use the following formula that specifies how you can count and
how you can calculate the sum of an arithmetic sequence.
So it goes like this.
The sum equals the sum of an elements equals two with the initial value plus the last value.
OK, the Ethereum multiplied by NP, which is the total number of elements in a given sequence divided
by two.
OK, so that's how you use it.
That's our formula.
That's the formula we are going to use for our calculations.
And of course, once again, we could have done it on a piece of paper.
But now what we have to do is to make it programmatically in our programming language.
So just to show you guys an example so we know SFM equals to this terminology of these formula.
So what will be the sum of these now of this sequence instead of calculating it one by one and adding
the result, it will be as of an equals to one, because that's the initial term.
Alphen, which is the anthem, which is 17 multiplied by an equals two nine nine elements divided by
two, which gives us a total of 18 multiplied by nine, divided by two, which is a total of nine,
multiplied by nine, which is a total of eighty one.
So that will be the sum of all the elements inside of this sequence with nine elements.
So I hope the task is clear to you guys.
Simply write a program that should read from the user and the element, which is an initial theorem,
a one in total terms, and the program should calculate the sum of these given arithmetic sequence.
So give it a try and I will see you in the Solutions video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.