Will this solution work for the Mod & Div Practice Question? I tried it myself first but the approaches we have taken are different. Kindly let me know. Input CENTS CENTS_F = 0 QUARTER = 0 DIME = 0 NICKEL = 0 PENNY = 0 Loop while CENTS > 99 then Output (‘Value too big, has to be at a maximum of 99 cents’) Input CENTS Endloop Loop while CENTS_F != 0 if Q = CENTS div 25 Q = QUARTER CENTS_F = CENTS - (QUARTER * 25) Else if D = CENTS_F div 10 D = DIME CENTS_F = CENTS_F - (DIME * 10) Else if N = CENTS_F div 5 N = NICKEL CENTS_F = CENTS_F - (NICKEL * 5) Else if P = CENTS_F div 1 P = PENNY CENTS_F = CENTS_F - (PENNY * 1) Endif End loop
When you use mod, you're finding the remainder after division, but that can't happen unless the first number is bigger than the second. Until that point, the first number will be your answer.
I'm pretty sure you made mistakes in the cents example as you calculated the remainder wrong. It should have been remainder = remainder mod 10, and so on... otherwise great video man😄
Good catch! I hadn't noticed that. Well, hopefully it at least illustrated how mod and div worked, which was the main objective. I'll publish a correction in the description.
I make mistakes too: LINK TO CORRECT MOD AND DIV EXERCISE CODE: docs.google.com/document/d/14WVgRFiqKdUzz13FvukFh1GzUWitr26CZUThyKBWnnE/edit?usp=sharing
Your series is very helpful to al cs students, you have no idea. Please if you can practice some more SL past papers questions. Thank you so much 🙏🙏🙏🙏
I'll see what I can do. I'm still working on Option D and rapidly running out of time before the exams 😭
Im very glad I found your channel just right before my semester examinations, thank you so much🙏
youre the best, im studying for my first mocks and these videos are great!
Good luck on your mocks!
@@TheCSClassroom Thank you
once again, thank you so much!!! i've been using your videos to prepare for mocks, and the pseudocode video are amazing ☺
Glad they're helping! Good luck with the mocks!
5:52 it should be 5 right?
Yes, I actually linked a different, correct Mod and Dic example in the comments - this one was kind of a mess.
I have a question why do you write name(30) and Weight(30) and Height(30) in 30:56 is it supposed to be 29
The 30 refers to the number of elements in the array, not the index of the last element in the array.
Thank you Big Dog - I want to see them practice problems
please do more ib examples for HL topics
I made a 3-part series on Topic 5: ruclips.net/video/M5QYynjOaRU/видео.html
Hey, very random question but what keyboard do you use? It sounds so nice in your examples haha
Haha, I just use my MacBook keyboard.
@@TheCSClassroom oh makes sense, thank you for the videos!
could you please explain how to solve trace tables as well?
I'll look into it
Will this solution work for the Mod & Div Practice Question? I tried it myself first but the approaches we have taken are different. Kindly let me know.
Input CENTS
CENTS_F = 0
QUARTER = 0
DIME = 0
NICKEL = 0
PENNY = 0
Loop while CENTS > 99 then
Output (‘Value too big, has to be at a maximum of 99 cents’)
Input CENTS
Endloop
Loop while CENTS_F != 0
if
Q = CENTS div 25
Q = QUARTER
CENTS_F = CENTS - (QUARTER * 25)
Else if
D = CENTS_F div 10
D = DIME
CENTS_F = CENTS_F - (DIME * 10)
Else if
N = CENTS_F div 5
N = NICKEL
CENTS_F = CENTS_F - (NICKEL * 5)
Else if
P = CENTS_F div 1
P = PENNY
CENTS_F = CENTS_F - (PENNY * 1)
Endif
End loop
Output (QUARTER ‘Quarters’, DIME ‘Dime’, NICKEL ‘Nickel’, PENNY ‘Penny’)
why is 3 mod 28 = 3
When you use mod, you're finding the remainder after division, but that can't happen unless the first number is bigger than the second. Until that point, the first number will be your answer.
I'm pretty sure you made mistakes in the cents example as you calculated the remainder wrong. It should have been remainder = remainder mod 10, and so on... otherwise great video man😄
Good catch! I hadn't noticed that. Well, hopefully it at least illustrated how mod and div worked, which was the main objective. I'll publish a correction in the description.
I make mistakes too:
LINK TO CORRECT MOD AND DIV EXERCISE CODE:
docs.google.com/document/d/14WVgRFiqKdUzz13FvukFh1GzUWitr26CZUThyKBWnnE/edit?usp=sharing