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 in this exercise, what we were requested to do is to find the anthe term, the ends term off an
arithmetic arithmetic sequence, and what we have to do is simply to use the following formula that
says and OK, the end term of this sequence will be equal to a one which is the initial term, plus
and minus one multiplied by the difference.
OK, so what we will simply have to do is to write a simple program that will read as the input all
of these three values, the initial term, the number of elements and the difference.
And based on these terms, we will calculate based on this formula, a mathematical formula.
We will calculate what will be the anthem of this given arithmetic sequence that starts at initial term
of a one with end values and the difference of D..
So let's go.
And the first thing that we have to do is simply create these variables.
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
coin type.
So float a one and we simply declare them and also we will declare the variable N and the main question
is, should we declare an is an integer or should we declare it is a floating point.
I just like a one in D in the answer is very simple.
We know that N represents the number of elements in a given arithmetic sequence.
So if it represents a given number.
Right.
It's probably going to be of an integer type because there may be two elements, three elements, five
elements, 10 elements.
But chances are not high that there will be two one, two and a half elements or a three in the third
elements.
Right.
That's not something that's going to happen.
So intense.
OK, and now what we are going to do is simply to run these print off-line.
So answer the initial term a one.
Right.
So we will read a one and then we will simply use kind of function to read this value and store it inside
a one.
Variables will present the Jeff because we are using a float type variable.
So it's kind of percentage are in here specifying the address of a one and that's it.
And now once we have a one, we also want to read the value of D, so please answer the difference,
the difference in the arithmetic arithmetic sequence.
OK, so for this given sequence that you want to calculate the end term, insert the difference between
any two consecutive elements, of course use the value from the council using this kind of function
and storage inside of the variable.
OK, is that clearer.
So far, good.
So finally, what we have to do for us to calculate and to use these formula, we know that A1, we
have it.
We also have the difference.
So another thing that we have to know is how many elements are there in this given sequence?
So for that, simply use additional last print F line for reading the information from the user.
Or so panter the number of elements of elements, elements in the RF medic sequence.
So now you have this kind of function and read it using the percentage placeholder and store side variable.
And so the first part of getting all the information necessary to calculate the anthe term of an arithmetic
sequence is now complete.
Now all that remains to do is just to print the result.
OK, so we can simply do it like this.
So print out and use it like at the end of term.
OK, off the arithmetic.
Our arithmetic sequence equals two percentage F backslash and instead of eight percent.
Jeff, what do you think we should use instead of this percentage if it should be a one?
Right.
The value of a one plus and minus one multiplied by the so simply taking these formula and we know that
these formula will give us the value of the ends term and we simply use it here.
And this value that will be calculated from this expression will be placed instead of this percentage
placeholder and the value and the result will be printed to the screen.
So let's just build and run it.
So there you go into the initial theorem, a one.
And previously it was one.
We had a difference between any two neighbors elements.
It was two.
And enter the number of elements in arithmetic sequence.
What was the number of elements?
I think it was nine.
And there you go.
The anthem of the arithmetic sequence equals to 17, just like we had in our example.
So pretty awesome guys.
We also covered some topic from math and we know how to use formulas for math in our programming language.
See, so also, maybe some of you would like to add additional variable and I don't know what to call
it again.
OK, that will represent the theorem.
And just before using these these print off-line are some of my students actually solved this exercise
just like this so and equals two and take all of these expression right from there.
Right.
Because we know that it's kind of exactly our formula.
So instead of this, we will simply use here again and the result is going to be the same.
So one, two and equals like nine.
So seventeen.
And if you would like to know what will be the value in having is a given arithmetic sequence, for
example, if you have one hundred number of elements, so the number is going to be one hundred and
ninety nine.
So awesome.
The formula seems to be working correctly.
And that's it I guess, right.
Yes.
So my name once again.
My name is Lord.
This is Alphatech and thank you so much for watching.
I will see you.
Thank you so much, so much for watching.
And I will see you in the next video.
Have a great day.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.