1
00:00:05,960 --> 00:00:07,310
Hey, guys, what's up?

2
00:00:07,730 --> 00:00:09,950
So today we are solving one more problem.

3
00:00:10,370 --> 00:00:12,020
So the drug treatment is very simple.

4
00:00:12,730 --> 00:00:20,730
Given in use, it will give us the value of N and we have to find some of it legit, some of it.

5
00:00:22,160 --> 00:00:29,570
So given given a number and find some of it digit.

6
00:00:30,080 --> 00:00:33,560
For example, if the value of an is my number is let's say.

7
00:00:34,610 --> 00:00:41,030
347 some output should be three plus four plus seven, which is.

8
00:00:42,270 --> 00:00:42,700
Fourteen.

9
00:00:43,620 --> 00:00:43,770
OK.

10
00:00:44,260 --> 00:00:50,520
Similarly to the well, you know, my number is 123 some output, Richard Reid one plus two plus three,

11
00:00:50,610 --> 00:00:51,600
which is six.

12
00:00:52,380 --> 00:00:55,860
Similarly, if the number is one, some output should be.

13
00:00:56,910 --> 00:00:58,360
So my answer should be one.

14
00:00:59,430 --> 00:01:01,330
Similarly, if my number is, let's say ten.

15
00:01:01,530 --> 00:01:08,720
Some output should be one plus zero, which is when if my number is let's say 25, some are, which

16
00:01:08,720 --> 00:01:11,730
would be two plus five, which is seven.

17
00:01:12,870 --> 00:01:18,270
So problem is very easy, given a number and we have to find some of its legit.

18
00:01:19,790 --> 00:01:20,030
OK.

19
00:01:20,550 --> 00:01:22,410
So how we can solve this problem?

20
00:01:24,020 --> 00:01:27,820
If you want to think, if you want to take some time, you can, both of you.

21
00:01:28,650 --> 00:01:28,880
OK.

22
00:01:29,420 --> 00:01:33,290
So the solution is the algorithm for solving this problem is very easy.

23
00:01:35,090 --> 00:01:35,990
So what do we do?

24
00:01:36,800 --> 00:01:40,350
So, for example, my number is three 47.

25
00:01:41,990 --> 00:01:47,040
So first of all, what I will do 347 Modulus 10.

26
00:01:47,510 --> 00:01:50,270
So Waterloo output Remender, which is seven.

27
00:01:52,360 --> 00:02:01,260
OK, then I will divide 347 Biotin, which is thirty four point seven, but in deejayed up on A.J. has

28
00:02:01,270 --> 00:02:04,090
to be in in BIJA, which is 34.

29
00:02:05,820 --> 00:02:17,190
OK, now I will 34, now 34, more than last digit for 34, divided by a ten three point four, which

30
00:02:17,190 --> 00:02:18,050
is three.

31
00:02:18,690 --> 00:02:23,000
Now three more then will give me the last digit, which is three.

32
00:02:23,670 --> 00:02:26,400
Now three divided by ten, which is zero.

33
00:02:26,400 --> 00:02:28,410
Point three, which is zero.

34
00:02:28,830 --> 00:02:30,570
So when we reach zero, stop.

35
00:02:32,070 --> 00:02:37,340
So where did you answer seven plus four plus three.

36
00:02:40,200 --> 00:02:41,640
OK, so this will be my answer.

37
00:02:42,120 --> 00:02:45,060
Seven plus four plus three, which is.

38
00:02:46,150 --> 00:02:46,660
14.

39
00:02:48,230 --> 00:02:48,960
So this is our.

40
00:02:49,020 --> 00:02:50,850
This alone will work.

41
00:02:52,520 --> 00:02:53,660
So what I will do?

42
00:02:54,170 --> 00:02:56,660
Find the last digit.

43
00:02:58,250 --> 00:02:59,620
Find last digit.

44
00:03:00,110 --> 00:03:01,430
How I can find last digit.

45
00:03:02,460 --> 00:03:06,060
No, MAAD, then will you give me the last digit?

46
00:03:06,390 --> 00:03:11,220
You can see here seven was the last digit, four was the last digit.

47
00:03:11,910 --> 00:03:12,750
So if you take.

48
00:03:13,980 --> 00:03:15,390
More to turn off any number.

49
00:03:15,450 --> 00:03:16,980
It will give me the last digit.

50
00:03:17,820 --> 00:03:18,990
So you got the last digit.

51
00:03:19,500 --> 00:03:20,100
What do you will do?

52
00:03:20,160 --> 00:03:23,190
We will maintain a variable sum, which will initially be zero.

53
00:03:23,640 --> 00:03:31,360
And after finding the last digit, we will add the last digit to some because some equals some blis

54
00:03:31,520 --> 00:03:31,930
last.

55
00:03:32,370 --> 00:03:33,410
And now we will not.

56
00:03:33,600 --> 00:03:35,250
And now we are updating the number.

57
00:03:35,770 --> 00:03:36,050
OK.

58
00:03:36,450 --> 00:03:39,990
So number will be updated by number will be divided by 10.

59
00:03:41,840 --> 00:03:44,840
Here you can see 347 was divided by 10.

60
00:03:44,880 --> 00:03:47,010
So my new number is 34.

61
00:03:47,910 --> 00:03:51,270
So with the help of this line, I will get a new number.

62
00:03:51,360 --> 00:03:56,550
So this is new number 34 is new number and 347 was all the number.

63
00:03:57,210 --> 00:04:01,950
Similarly, you can see here, 34 was here, all the number.

64
00:04:02,280 --> 00:04:07,390
And by dividing sorry, the 34 was all in the mood here and dividing by 10.

65
00:04:07,470 --> 00:04:09,390
I will get three, which is my new number.

66
00:04:09,990 --> 00:04:12,000
So with the help of this, I will get a new number.

67
00:04:12,600 --> 00:04:17,820
And how many times I will find the last digit and last digit.

68
00:04:18,180 --> 00:04:19,310
And update a number.

69
00:04:20,040 --> 00:04:21,870
Bill, I get a zero.

70
00:04:23,220 --> 00:04:25,860
Daily, my new number is not close to zero.

71
00:04:26,700 --> 00:04:27,900
So what I will do.

72
00:04:28,710 --> 00:04:29,880
So let me write the code.

73
00:04:35,040 --> 00:04:36,600
So I will do something like this.

74
00:04:38,310 --> 00:04:40,680
Initially, my sum will be zero.

75
00:04:41,490 --> 00:04:43,860
Now, how many times I have to run the loop?

76
00:04:44,010 --> 00:04:45,840
How many times I will find last digit?

77
00:04:46,240 --> 00:04:48,540
Add Lustiger to the same update the number.

78
00:04:48,570 --> 00:04:50,740
How many times daily?

79
00:04:50,910 --> 00:04:51,720
My number.

80
00:04:53,020 --> 00:04:55,990
Is Nathi close to zero Deleware in the mud?

81
00:04:56,170 --> 00:04:57,500
As in articles two zero?

82
00:04:57,550 --> 00:04:58,270
What I will do.

83
00:04:58,510 --> 00:04:59,980
I will find the last digit.

84
00:05:00,790 --> 00:05:07,120
So end let's call it digit, which is number MAAD 10.

85
00:05:07,900 --> 00:05:09,790
So I will get the last digit.

86
00:05:10,630 --> 00:05:17,800
Now, after getting the last digit, I will add this digit to my variable some.

87
00:05:20,070 --> 00:05:22,680
And now we have to update our number.

88
00:05:23,100 --> 00:05:26,070
So number equals number by 10.

89
00:05:27,550 --> 00:05:28,450
And finally.

90
00:05:30,690 --> 00:05:32,840
We will see out some.

91
00:05:33,330 --> 00:05:35,670
So this is all that we have to do.

92
00:05:37,270 --> 00:05:37,520
OK.

93
00:05:38,620 --> 00:05:45,710
So, for example, let's take an example to the Valley of and is 123 OK?

94
00:05:46,480 --> 00:05:46,930
So.

95
00:05:49,520 --> 00:05:50,860
I am writing my output here.

96
00:05:54,000 --> 00:05:57,020
So initially, my variable sum equals zero.

97
00:05:57,510 --> 00:05:59,990
So check the condition is one quantity.

98
00:06:00,240 --> 00:06:01,110
It goes to zero.

99
00:06:01,350 --> 00:06:01,580
No.

100
00:06:02,160 --> 00:06:04,130
The condition is the condition is two.

101
00:06:04,230 --> 00:06:05,550
Number is not close to zero.

102
00:06:05,730 --> 00:06:06,630
You will come inside.

103
00:06:08,010 --> 00:06:10,260
And Bridget did this.

104
00:06:10,460 --> 00:06:14,390
Find out the last digit digit equals three.

105
00:06:15,590 --> 00:06:17,000
Now add this digit.

106
00:06:17,270 --> 00:06:18,590
The way the variable some.

107
00:06:19,040 --> 00:06:20,060
So some will become.

108
00:06:20,210 --> 00:06:20,570
Three.

109
00:06:21,500 --> 00:06:22,700
Now, update the number.

110
00:06:22,760 --> 00:06:24,350
Number equals number by ten.

111
00:06:24,740 --> 00:06:25,900
So a new number equals.

112
00:06:27,260 --> 00:06:28,670
Now check the condition again.

113
00:06:30,090 --> 00:06:33,450
So is will it close to zero?

114
00:06:34,470 --> 00:06:34,710
No.

115
00:06:34,800 --> 00:06:38,250
The condition is to it is not close to zero.

116
00:06:38,970 --> 00:06:40,260
You will come inside the loop.

117
00:06:42,130 --> 00:06:51,430
So any digital clues, no more than that as the last digit digit, it was to add a digit to some.

118
00:06:51,580 --> 00:06:56,830
So some will become three below store, which is five, upbraid the number.

119
00:06:57,070 --> 00:07:02,140
So number will become twelve by ten, which is when I would check the condition again.

120
00:07:03,690 --> 00:07:07,970
So is when articles two zero, the condition is true, you will come inside.

121
00:07:09,050 --> 00:07:09,250
OK.

122
00:07:09,350 --> 00:07:11,520
When is not close to zero, the condition is true.

123
00:07:11,620 --> 00:07:11,980
Yes.

124
00:07:12,050 --> 00:07:13,280
When it's not to close to zero.

125
00:07:13,940 --> 00:07:15,740
Find the last digit, which is one.

126
00:07:16,170 --> 00:07:17,740
Add this digit some.

127
00:07:18,350 --> 00:07:19,250
So some will become.

128
00:07:20,120 --> 00:07:21,230
Here it was five.

129
00:07:21,380 --> 00:07:23,660
So five plus one, which is six.

130
00:07:24,440 --> 00:07:27,620
So somebody becomes six and you have to update the number.

131
00:07:27,680 --> 00:07:31,940
So number equals number about ten, which is one by ten, which is zero.

132
00:07:32,790 --> 00:07:33,950
Now I will check the condition.

133
00:07:34,550 --> 00:07:37,250
So here zero is not close to zero.

134
00:07:37,940 --> 00:07:41,480
This condition is void because zero equals zero.

135
00:07:41,970 --> 00:07:43,300
OK, so this condition is false.

136
00:07:43,310 --> 00:07:48,770
You will come out of the loop of your loop, will terminated and you will print some, which is six

137
00:07:48,860 --> 00:07:49,940
and which is my output.

138
00:07:50,690 --> 00:07:51,740
So let us write the code.

139
00:07:52,520 --> 00:07:54,110
Then I will explain it one more time.

140
00:07:57,240 --> 00:07:58,890
So let us name this file as.

141
00:08:03,180 --> 00:08:06,330
Some of digits.

142
00:08:10,040 --> 00:08:10,960
Not CBP.

143
00:08:27,170 --> 00:08:29,720
Now, what I have to do, I will take a number.

144
00:08:31,030 --> 00:08:32,240
And Bert Fundi use it.

145
00:08:32,440 --> 00:08:34,950
So N10 seen.

146
00:08:35,560 --> 00:08:44,590
And now I will take a variable, some equals zero, which will finally contain the sum of digits.

147
00:08:45,640 --> 00:08:54,110
So while my number is not close to zero, what I have to do, I will find out the last Midgard.

148
00:08:55,290 --> 00:08:55,540
So.

149
00:08:56,280 --> 00:08:58,900
And let's call last.

150
00:09:00,780 --> 00:09:04,200
Digit, which is equal to number.

151
00:09:05,510 --> 00:09:06,680
Maude, 10.

152
00:09:06,870 --> 00:09:16,920
So I got the last budget and I have to add this digit to my variable sum, so some plus it goes to last

153
00:09:17,460 --> 00:09:18,000
digit.

154
00:09:18,870 --> 00:09:21,090
And now I have to update my number.

155
00:09:21,540 --> 00:09:27,450
So number equals number equals number by 10.

156
00:09:28,590 --> 00:09:32,230
And finally, my answer will be stored in variable some.

157
00:09:32,910 --> 00:09:36,510
So I will print out some.

158
00:09:37,710 --> 00:09:39,360
So this is all that we have to do.

159
00:09:41,860 --> 00:09:42,100
OK.

160
00:09:45,420 --> 00:09:46,800
So let us test our program.

161
00:09:49,470 --> 00:09:51,510
Layer to level value of is 123.

162
00:09:51,920 --> 00:09:53,270
So our approach would be six.

163
00:09:55,330 --> 00:09:57,490
No, test it one more time.

164
00:09:59,800 --> 00:10:02,280
Let's see, my number is 10.

165
00:10:03,150 --> 00:10:04,370
So outproduce when.

166
00:10:04,920 --> 00:10:05,110
OK.

167
00:10:05,280 --> 00:10:07,900
One plus you always won some accord is.

168
00:10:07,920 --> 00:10:08,610
Hundred percent.

169
00:10:08,640 --> 00:10:09,030
Correct.

170
00:10:09,750 --> 00:10:15,450
If you're having difficulty in understanding this condition, what you can also do here is you can write

171
00:10:16,530 --> 00:10:22,290
while my number is good than zero because we have to stop when number equals zero.

172
00:10:22,680 --> 00:10:26,610
So the numbers are good, then zero, you will be able to find out the last digit.

173
00:10:28,010 --> 00:10:33,030
OK, so this is also a condition you can also use that a condition if you are not able to understand

174
00:10:33,470 --> 00:10:34,280
previous condition.

175
00:10:36,250 --> 00:10:39,400
So let's say my number is 25, so output is seven.

176
00:10:41,030 --> 00:10:42,320
Now, let us test out.

177
00:10:42,470 --> 00:10:50,940
No, no, no, let us barran our program for any cause, let's say then when it goes down.

178
00:10:51,890 --> 00:10:55,060
So initially, some equals zero.

179
00:10:55,550 --> 00:10:58,460
Now a check is 10 Gurdon's zero.

180
00:10:58,580 --> 00:11:01,760
Yes, the condition is through last digit.

181
00:11:01,880 --> 00:11:05,990
So last digit will be no more than 10.

182
00:11:06,050 --> 00:11:08,270
So 10 more 10, which is zero.

183
00:11:09,920 --> 00:11:11,650
And this last digit to some.

184
00:11:12,700 --> 00:11:17,520
So some equals all the value of some plus lastra digit zero.

185
00:11:18,200 --> 00:11:21,610
Now update the numbers on the medical's number by then.

186
00:11:22,460 --> 00:11:28,000
So number equals all the value of number by ten, which is one.

187
00:11:28,830 --> 00:11:30,350
Now check the condition again.

188
00:11:30,920 --> 00:11:32,450
So one is better than zero.

189
00:11:33,170 --> 00:11:34,300
One is better than zero.

190
00:11:34,360 --> 00:11:35,600
Yes, the condition is true.

191
00:11:35,720 --> 00:11:38,120
You will go inside, find the last four digit.

192
00:11:39,300 --> 00:11:44,320
So last digit a close to one more.

193
00:11:44,540 --> 00:11:44,940
Ten.

194
00:11:45,050 --> 00:11:46,370
Which is when.

195
00:11:47,090 --> 00:11:51,140
And then you have to add this last digit to variable sum.

196
00:11:51,590 --> 00:11:57,110
So some equals all the value of some, which is zero plus last budget, which is one.

197
00:11:57,140 --> 00:11:58,340
So some equals one.

198
00:11:58,970 --> 00:12:00,680
Now you will update the number.

199
00:12:00,740 --> 00:12:06,900
So number equals number by ten, which is one by 10, zero point one, which is zero.

200
00:12:06,950 --> 00:12:09,480
Because in digit upon integer is in Indonesia.

201
00:12:10,310 --> 00:12:11,980
Now you will check the condition again.

202
00:12:13,370 --> 00:12:14,940
So is zero good.

203
00:12:14,990 --> 00:12:16,320
Then Enquist is zero good.

204
00:12:16,460 --> 00:12:16,850
Zero.

205
00:12:16,940 --> 00:12:18,740
No, the condition is false.

206
00:12:19,370 --> 00:12:23,690
Since the condition is false, our loop will terminate.

207
00:12:23,810 --> 00:12:26,950
And I will reach line number 17.

208
00:12:27,140 --> 00:12:28,400
So I will print some.

209
00:12:29,060 --> 00:12:30,940
So my sum is containing one.

210
00:12:31,760 --> 00:12:34,730
And output for this number should be one.

211
00:12:35,830 --> 00:12:39,460
Obviously, this is how our program is working.

212
00:12:41,140 --> 00:12:45,670
Initially, what happened is you will find difficult to understand all of these things.

213
00:12:46,300 --> 00:12:47,310
So how against.

214
00:12:47,630 --> 00:12:48,610
Understand these things.

215
00:12:48,640 --> 00:12:51,260
So the only ways they go to a pen and paper.

216
00:12:51,940 --> 00:12:52,250
Right.

217
00:12:52,270 --> 00:12:53,170
Hold on your own.

218
00:12:53,230 --> 00:12:55,390
Try to understand how things are working.

219
00:12:55,870 --> 00:12:59,740
And with a little more practice, you will be able to chorded yourself.

220
00:13:00,520 --> 00:13:02,230
I will be solving many such problems.

221
00:13:02,680 --> 00:13:04,090
So just to follow my approach.

222
00:13:04,120 --> 00:13:06,130
How I'm approaching these problems.

223
00:13:06,960 --> 00:13:07,230
OK.

224
00:13:07,600 --> 00:13:09,520
So initially, everyone faces difficulty.

225
00:13:09,580 --> 00:13:14,730
I also faced a difficulty when I first see how to find some digits.

226
00:13:15,640 --> 00:13:17,080
OK, so it's completely normal.

227
00:13:17,290 --> 00:13:18,550
If I'm facing difficulty.

228
00:13:19,120 --> 00:13:21,370
So if you have any doubt, feel free to ask.

229
00:13:21,580 --> 00:13:21,850
OK.

230
00:13:22,870 --> 00:13:23,340
Thank you.
