Learn Programming with C++ - Modulus Operator

preview_player
Показать описание
This video is part of the Learn Programming with C++ video series. In this video, I discuss the modulus operator and how it's used to determine the remainder from an integer division as well as how it is usually used in code. #coding #programming #cplusplus #computerscience

___ Social Media ___

___ Equipment ___
Рекомендации по теме
Комментарии
Автор

As a beginner, i found it quite useful. thumbs up!

kinzamir
Автор

With that week as an example, you gave a nice explanation.

ms-hicc
Автор

The best explanation of mod(%) with it's use.

rakibrafi
Автор

Thanks for understandable language u speak

tejasbomble
Автор

If you can't understand why we use % to get a number less than the one we want it's because if you divide by 3 for example you have to get a number less than 3 because if a number equal to 3 or more existed than 3 would divide it, so it wouldn't be possible for example 12 / 3 = 4 because we can no longer divide by 3 and there is no remainder so it's 4 if there was a remainder that would be the % and the remainder can't be 3 because then the result will be more than 4 . It took me some time to get that, thank you God.

MuslimMan
Автор

You forgot to mention that it's often used to check if a number is odd or even.
if (myInteger % 2 == 0)
std::cout << "myInteger is even.\n";
else
std::cout << "myInteger is odd.\n";

zdspider
Автор

Thank you this makes so much more sense. Even Full Sail couldent explain it to me right lmao.

bensmash
Автор

This is what i missed before 😀.. thanks a lot

ikazodba
Автор

what happens to the modulus when the numerator is bigger than the denomerator

jimcarol
Автор

Im that guy that would type 10 on your program lol

Thanks for the explanation though.

Perceptionz_Sound
Автор

Shouldn't the answer be Tuesday? As the count here starts from 0, Sunday.

NikolainYT
Автор

When 10%2 = 0, then why 2%10 = 2? why not 0? 2%10 gives the remainder "0" not "2" - Do anyone has a solid explanation?

yasirzubair
Автор

Try giving 37/6 the result v get is 6 what's the reason!?

tejasteju