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
All right.
So I see you are really curious and interested in knowing how much money can you get, aren't you?
So to get a good answer for that, let's write a program that will be able to distinguish between the
two options and to give us some colleagues later decision with the best choice.
So for that, we will, first of all, create our eye variable because we are going to use Loop's here,
right?
Because we have 30 days.
And what is better to use here rather than using just a for loop?
So for a for a loop, we are going to create an eye variable.
So Amed I in this variable will simply represent the day we are currently at.
Right.
We want to find out how much money we're getting after 30 days.
So also we are going to create another variable and call it.
Let's see.
Week.
Week.
Let's say a week.
Some.
OK.
And week song is just the sum of all the money of all the million dollars we can get right now.
I mean, quickly, we can get it.
So one million.
One million dollar.
OK.
And also we are going to gabbed all likes double or float.
Doesn't matter.
So float total.
Total a month.
Total amount.
Total amount of money.
So what will what what will it be.
Just one penny.
One cent.
So zero point zero one.
OK.
So that's the amount we have.
And they number one.
So are day number one.
And now we are going to write a scene below.
So we are using for a loop because we know the total amount of times we have to use.
Some some commands.
So I equals to one.
And as long as I is less or equals to 30.
We are going to run this little body and hour after every iteration.
We are going to increment I by one.
So meaning a total of 30 times the loop body is going to be executed.
And on every iteration we are going to double to double to multiply by two.
That are up to the total amount.
So we are going to use total amount.
Equals to the previous total amount multiplied by two.
Is this OK?
We simply multiply the total amount every day.
And once we are out of these loop, once we are done running of these loop 30 times, using this multiplication,
we are going to receive here at this point.
We will have the total amount after 30 days.
So will it be better than just getting to the quick some that one millions dollar right away?
Let's find out.
So we can use least printf command.
And just to specify something like this.
So.
Printf total amount.
Total.
Total amount.
Total amount.
After 30 days.
30 days, please.
Let's see.
Percentage.
F.
Right.
It's a floating point.
Yes.
And a backslash.
And at the end.
And instead of that, we are going to specify here that the total amount semicolon at the end.
And there you go.
And now it's tried to build and write and see what happens and what's the amount of money that we are
getting.
So build and run it.
And let's see what happens.
Oh, wow.
Oh, well, how much is that?
So here we have this thousand.
Basically, it's more we are getting more than ten million dollars.
OK.
So that's pretty amazing, guys.
That's over ten million dollars.
And it's much better, probably, right, than just getting today one million dollars.
If we know that after 30 days, if we get today one penny, one cent, we are going to end up with more
than ten million dollars.
That's amazing video thing.
That is the case.
My bet.
Not all of you.
OK.
So what I want you to notice here is two little let's let's just add some command commands that will
demonstrate the process of the calculation.
Let's just bring down the total amount of money earned at each day.
So I want to know how much money, how much money I had on day one.
Day two.
And after 30 days.
OK.
And to do so, we are simply going to add these primitive flying in the loop body and we are going to
do it here.
So print F, print F and specify the number of the day.
So day percentage D.
OK.
We are going to take day one.
So that's will be the I value and the two and day three and so on on every duration.
And we are going to specify like this and amount.
And let's do it like percentage.
What was it like.
Percent.
Two F.
And here we are going to specify the amount of money we have at each day.
So there you go.
Backslash and and here we are going to specify.
I write for these percentages.
And for these percentage F, we are going to specify the total amount.
So far gained up to these days.
All right.
So that's good enough.
And now let's let's just explain once again what this point to means.
It's simply edited to specify that only two digits after the floating point number that we are going
to get hearing total amount that only two to two digits are allowed after the floating point.
OK.
Good, good, good.
So now, guys, you even made sure that we will see all the process.
So let's just build and run it right now.
And we can see that on day number one, we have one penny, two pennies and day two for penny some day
three.
And after 20 days, we have already ten thousand dollars.
And on day twenty eight, we already have more than a million dollars.
And day 30.
And what we're missing here is that we print on day one.
Day two, the three previously I printed out after what will be the result of there.
So that's the first day.
And for 30 days.
OK, so we have to print also day 31 because we started already from day one and we want to do this
process for a 31 days.
So that's ah, that's the last messages.
The total amount after 30 days.
It's day number thirty one after 30 days.
So I hope that's clear, guys.
And now you know how how this process works and you know how what you would choose if somebody would
ask you what you prefer, a million dollars or just one penny doubled for the next 30 days.
So that was a very interesting question.
And what I want you to know here is don't rush to decide any arbitrary decisions.
Think about it.
And if you can even write a program that will find out what is the better solution for you.
Thank you guys for watching.
Sure.
This video with your friends.
Let them know this question.
Actually, share it with your friends.
Ask them what they will prefer and prove them if they're wrong.
I'll see you in the next video.
Goodbye.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.