Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,560 --> 00:00:01,250
All right.
2
00:00:01,280 --> 00:00:06,650
So I see you are really curious and interested in knowing how much money can you get, aren't you?
3
00:00:07,220 --> 00:00:12,440
So to get a good answer for that, let's write a program that will be able to distinguish between the
4
00:00:12,440 --> 00:00:18,800
two options and to give us some colleagues later decision with the best choice.
5
00:00:19,130 --> 00:00:24,740
So for that, we will, first of all, create our eye variable because we are going to use Loop's here,
6
00:00:24,740 --> 00:00:25,040
right?
7
00:00:25,070 --> 00:00:27,080
Because we have 30 days.
8
00:00:27,110 --> 00:00:32,510
And what is better to use here rather than using just a for loop?
9
00:00:32,870 --> 00:00:36,380
So for a for a loop, we are going to create an eye variable.
10
00:00:36,410 --> 00:00:42,560
So Amed I in this variable will simply represent the day we are currently at.
11
00:00:42,590 --> 00:00:42,770
Right.
12
00:00:42,800 --> 00:00:47,360
We want to find out how much money we're getting after 30 days.
13
00:00:47,480 --> 00:00:50,930
So also we are going to create another variable and call it.
14
00:00:50,960 --> 00:00:51,410
Let's see.
15
00:00:51,500 --> 00:00:51,870
Week.
16
00:00:52,050 --> 00:00:52,330
Week.
17
00:00:52,790 --> 00:00:53,840
Let's say a week.
18
00:00:53,840 --> 00:00:54,230
Some.
19
00:00:54,320 --> 00:00:54,620
OK.
20
00:00:55,010 --> 00:01:01,190
And week song is just the sum of all the money of all the million dollars we can get right now.
21
00:01:01,280 --> 00:01:02,810
I mean, quickly, we can get it.
22
00:01:02,840 --> 00:01:04,670
So one million.
23
00:01:04,790 --> 00:01:06,130
One million dollar.
24
00:01:06,170 --> 00:01:06,470
OK.
25
00:01:07,130 --> 00:01:11,920
And also we are going to gabbed all likes double or float.
26
00:01:12,220 --> 00:01:12,980
Doesn't matter.
27
00:01:13,220 --> 00:01:14,870
So float total.
28
00:01:14,960 --> 00:01:16,280
Total a month.
29
00:01:16,340 --> 00:01:17,150
Total amount.
30
00:01:17,450 --> 00:01:19,010
Total amount of money.
31
00:01:19,130 --> 00:01:21,460
So what will what what will it be.
32
00:01:21,620 --> 00:01:22,880
Just one penny.
33
00:01:22,880 --> 00:01:23,560
One cent.
34
00:01:23,580 --> 00:01:26,400
So zero point zero one.
35
00:01:26,960 --> 00:01:27,150
OK.
36
00:01:27,260 --> 00:01:28,850
So that's the amount we have.
37
00:01:28,970 --> 00:01:30,880
And they number one.
38
00:01:31,160 --> 00:01:34,940
So are day number one.
39
00:01:35,150 --> 00:01:37,700
And now we are going to write a scene below.
40
00:01:37,820 --> 00:01:43,790
So we are using for a loop because we know the total amount of times we have to use.
41
00:01:44,640 --> 00:01:46,970
Some some commands.
42
00:01:47,330 --> 00:01:49,220
So I equals to one.
43
00:01:49,250 --> 00:01:53,180
And as long as I is less or equals to 30.
44
00:01:53,450 --> 00:01:58,130
We are going to run this little body and hour after every iteration.
45
00:01:58,370 --> 00:02:00,500
We are going to increment I by one.
46
00:02:00,860 --> 00:02:06,500
So meaning a total of 30 times the loop body is going to be executed.
47
00:02:06,530 --> 00:02:12,470
And on every iteration we are going to double to double to multiply by two.
48
00:02:12,770 --> 00:02:14,630
That are up to the total amount.
49
00:02:14,750 --> 00:02:17,580
So we are going to use total amount.
50
00:02:17,810 --> 00:02:21,680
Equals to the previous total amount multiplied by two.
51
00:02:21,860 --> 00:02:22,610
Is this OK?
52
00:02:22,790 --> 00:02:26,150
We simply multiply the total amount every day.
53
00:02:26,630 --> 00:02:34,520
And once we are out of these loop, once we are done running of these loop 30 times, using this multiplication,
54
00:02:34,850 --> 00:02:37,440
we are going to receive here at this point.
55
00:02:37,480 --> 00:02:40,850
We will have the total amount after 30 days.
56
00:02:41,000 --> 00:02:47,270
So will it be better than just getting to the quick some that one millions dollar right away?
57
00:02:47,750 --> 00:02:48,530
Let's find out.
58
00:02:48,620 --> 00:02:50,810
So we can use least printf command.
59
00:02:50,840 --> 00:02:52,910
And just to specify something like this.
60
00:02:53,000 --> 00:02:53,210
So.
61
00:02:53,350 --> 00:02:55,400
Printf total amount.
62
00:02:55,640 --> 00:02:56,180
Total.
63
00:02:56,300 --> 00:02:57,710
Total amount.
64
00:02:57,980 --> 00:02:58,700
Total amount.
65
00:02:58,790 --> 00:03:00,560
After 30 days.
66
00:03:01,060 --> 00:03:02,690
30 days, please.
67
00:03:03,080 --> 00:03:03,680
Let's see.
68
00:03:03,680 --> 00:03:04,230
Percentage.
69
00:03:04,370 --> 00:03:04,640
F.
70
00:03:04,670 --> 00:03:04,910
Right.
71
00:03:04,970 --> 00:03:06,110
It's a floating point.
72
00:03:06,140 --> 00:03:06,500
Yes.
73
00:03:06,920 --> 00:03:07,700
And a backslash.
74
00:03:07,700 --> 00:03:08,420
And at the end.
75
00:03:08,420 --> 00:03:13,750
And instead of that, we are going to specify here that the total amount semicolon at the end.
76
00:03:13,850 --> 00:03:15,050
And there you go.
77
00:03:15,200 --> 00:03:20,900
And now it's tried to build and write and see what happens and what's the amount of money that we are
78
00:03:20,900 --> 00:03:21,290
getting.
79
00:03:21,530 --> 00:03:22,940
So build and run it.
80
00:03:23,090 --> 00:03:25,370
And let's see what happens.
81
00:03:25,490 --> 00:03:26,780
Oh, wow.
82
00:03:26,980 --> 00:03:28,520
Oh, well, how much is that?
83
00:03:28,820 --> 00:03:31,190
So here we have this thousand.
84
00:03:31,580 --> 00:03:37,070
Basically, it's more we are getting more than ten million dollars.
85
00:03:37,130 --> 00:03:37,460
OK.
86
00:03:37,730 --> 00:03:39,680
So that's pretty amazing, guys.
87
00:03:39,830 --> 00:03:42,590
That's over ten million dollars.
88
00:03:42,680 --> 00:03:48,440
And it's much better, probably, right, than just getting today one million dollars.
89
00:03:48,710 --> 00:03:57,290
If we know that after 30 days, if we get today one penny, one cent, we are going to end up with more
90
00:03:57,500 --> 00:04:00,170
than ten million dollars.
91
00:04:00,290 --> 00:04:01,800
That's amazing video thing.
92
00:04:01,890 --> 00:04:03,110
That is the case.
93
00:04:03,140 --> 00:04:03,770
My bet.
94
00:04:03,830 --> 00:04:04,640
Not all of you.
95
00:04:04,660 --> 00:04:05,000
OK.
96
00:04:05,360 --> 00:04:12,800
So what I want you to notice here is two little let's let's just add some command commands that will
97
00:04:13,340 --> 00:04:15,770
demonstrate the process of the calculation.
98
00:04:15,890 --> 00:04:19,970
Let's just bring down the total amount of money earned at each day.
99
00:04:20,240 --> 00:04:24,930
So I want to know how much money, how much money I had on day one.
100
00:04:24,950 --> 00:04:25,610
Day two.
101
00:04:25,640 --> 00:04:27,390
And after 30 days.
102
00:04:27,440 --> 00:04:27,710
OK.
103
00:04:27,920 --> 00:04:34,820
And to do so, we are simply going to add these primitive flying in the loop body and we are going to
104
00:04:34,820 --> 00:04:35,480
do it here.
105
00:04:35,660 --> 00:04:40,580
So print F, print F and specify the number of the day.
106
00:04:40,610 --> 00:04:42,620
So day percentage D.
107
00:04:42,680 --> 00:04:43,030
OK.
108
00:04:43,130 --> 00:04:45,010
We are going to take day one.
109
00:04:45,050 --> 00:04:51,500
So that's will be the I value and the two and day three and so on on every duration.
110
00:04:51,950 --> 00:04:55,280
And we are going to specify like this and amount.
111
00:04:55,340 --> 00:04:58,040
And let's do it like percentage.
112
00:04:58,730 --> 00:04:59,570
What was it like.
113
00:04:59,570 --> 00:04:59,920
Percent.
114
00:05:00,170 --> 00:05:00,840
Two F.
115
00:05:01,010 --> 00:05:05,990
And here we are going to specify the amount of money we have at each day.
116
00:05:06,270 --> 00:05:08,360
So there you go.
117
00:05:08,390 --> 00:05:10,910
Backslash and and here we are going to specify.
118
00:05:11,000 --> 00:05:12,790
I write for these percentages.
119
00:05:13,190 --> 00:05:18,030
And for these percentage F, we are going to specify the total amount.
120
00:05:18,050 --> 00:05:21,350
So far gained up to these days.
121
00:05:21,500 --> 00:05:22,140
All right.
122
00:05:22,190 --> 00:05:24,080
So that's good enough.
123
00:05:24,500 --> 00:05:30,890
And now let's let's just explain once again what this point to means.
124
00:05:31,190 --> 00:05:38,150
It's simply edited to specify that only two digits after the floating point number that we are going
125
00:05:38,150 --> 00:05:45,440
to get hearing total amount that only two to two digits are allowed after the floating point.
126
00:05:45,470 --> 00:05:45,690
OK.
127
00:05:45,950 --> 00:05:46,670
Good, good, good.
128
00:05:46,820 --> 00:05:52,520
So now, guys, you even made sure that we will see all the process.
129
00:05:52,700 --> 00:05:55,130
So let's just build and run it right now.
130
00:05:55,370 --> 00:06:02,840
And we can see that on day number one, we have one penny, two pennies and day two for penny some day
131
00:06:02,840 --> 00:06:03,290
three.
132
00:06:03,650 --> 00:06:08,480
And after 20 days, we have already ten thousand dollars.
133
00:06:08,870 --> 00:06:14,000
And on day twenty eight, we already have more than a million dollars.
134
00:06:14,420 --> 00:06:15,740
And day 30.
135
00:06:15,740 --> 00:06:19,100
And what we're missing here is that we print on day one.
136
00:06:19,100 --> 00:06:26,840
Day two, the three previously I printed out after what will be the result of there.
137
00:06:28,280 --> 00:06:29,840
So that's the first day.
138
00:06:29,850 --> 00:06:31,350
And for 30 days.
139
00:06:31,400 --> 00:06:39,050
OK, so we have to print also day 31 because we started already from day one and we want to do this
140
00:06:39,290 --> 00:06:41,300
process for a 31 days.
141
00:06:41,480 --> 00:06:44,280
So that's ah, that's the last messages.
142
00:06:44,330 --> 00:06:46,160
The total amount after 30 days.
143
00:06:46,430 --> 00:06:50,240
It's day number thirty one after 30 days.
144
00:06:50,390 --> 00:06:51,980
So I hope that's clear, guys.
145
00:06:52,010 --> 00:07:00,260
And now you know how how this process works and you know how what you would choose if somebody would
146
00:07:00,260 --> 00:07:07,970
ask you what you prefer, a million dollars or just one penny doubled for the next 30 days.
147
00:07:08,090 --> 00:07:10,290
So that was a very interesting question.
148
00:07:10,370 --> 00:07:16,520
And what I want you to know here is don't rush to decide any arbitrary decisions.
149
00:07:16,850 --> 00:07:17,630
Think about it.
150
00:07:17,770 --> 00:07:24,140
And if you can even write a program that will find out what is the better solution for you.
151
00:07:25,040 --> 00:07:26,360
Thank you guys for watching.
152
00:07:26,600 --> 00:07:27,000
Sure.
153
00:07:27,050 --> 00:07:28,400
This video with your friends.
154
00:07:28,430 --> 00:07:30,200
Let them know this question.
155
00:07:30,530 --> 00:07:32,360
Actually, share it with your friends.
156
00:07:33,140 --> 00:07:38,180
Ask them what they will prefer and prove them if they're wrong.
157
00:07:38,330 --> 00:07:40,130
I'll see you in the next video.
158
00:07:40,460 --> 00:07:40,850
Goodbye.
12113
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.