Jak działa % ?
Ważne pytanie
Dyskutowane
Komentarze (6)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Anonymous #10570118
26 października 2021, 19:43
% jest to reszta pozostala z dzielenia. To nie jest to co pozostaje nam po przecinku z dzielenia!
11%3 = (11 - (3*3)
11%3 = (11 -9)
11%3 = 2
inne:
10%2 = 0
144 % 13 = 1 (144 - 143=1)
71 % 9 = 8
0
Robert
8 września 2020, 07:39
Modulo %
np. 15%3 = 0 ponieważ 15:3=5.0
np. 13%3 = 3 ponieważ 13:3=4.33
np. 13%5 = 6 ponieważ 13:5= 2.60
Modulo daje cyfrę/liczbę po przecinku wyniku dzielenia.
Działa podobnie jak dzielenie, tylko wynik inny.
0
Misiu
8 września 2020, 13:32
Oj, nieprawda. Przeczytaj tutejszy post GG z 22 stycznia.
0
Guadalupe Gagnon
22 stycznia 2020, 20:37
The modulo operator will give the remainder after division. For example:
13 % 5 = 3
because the remainder after 13 / 5 would be 3.
-------------------------------------
Operator modulo da resztę po podziale. Na przykład:
13% 5 = 3
ponieważ reszta po 13/5 to 3.
+1
Anonymous #10570118
26 października 2021, 19:45
5 + 5=10 i zostaje nam liczba 3 poniewaz wiecej 5 nie zmiescimy w liczbie 13.
0
Guadalupe Gagnon
26 października 2021, 19:58
Yes, a simple algorithm that does the same thing without the modulo operator would be:
Where x is the starting number and y is the number that you want to figure out the remainder. So in that example 13 would be x and 5 would be y. When the algorithm is done x would equal 3.
+1