+ 14

Please explain me how % works!?

31st Oct 2016, 11:36 AM
Sergei Belialov
Sergei Belialov - avatar
62 Respostas
+ 37
% returns the remainder of a division. 9 % 3 = 0 9 % 2 = 1 11 % 3 = 2
31st Oct 2016, 11:41 AM
Cohen Creber
Cohen Creber - avatar
+ 16
In usual way 9/2 = 4 r 1 In programming 9/2 = 4 (whole quotient) 9%2 = 1 (remainder only)
31st Oct 2016, 12:27 PM
Ariel A. Salvador Jr.
Ariel A. Salvador Jr. - avatar
+ 8
This is the formula: 7%3 = ? 7:3 = 2,³ (Make the division) 3*2 = 6 (Make Divider * number on the left of the comma) 7-6 = 1 (Now do the substraction and you have your result) 7%3 = 1 Source: School
22nd Dec 2016, 10:34 AM
Iván
Iván - avatar
+ 4
a%b => a=bq+r , now "r" is our answer like 9%3 => 9=3x3+0 , zero is our answer like 26%6 => 26=6x4+2 , now 2 is our answer i hope u understand this source : school
21st Dec 2016, 11:26 PM
Senpai
Senpai - avatar
+ 3
it shows only the remainder value...
21st Nov 2016, 2:53 AM
Deepzz Sweet
Deepzz Sweet - avatar
+ 3
% is know as remainder calculation operator.. where we calculate the division of two numbers and calculate theri mode(remainder) e.g. 10%2=0; 10%3=1; 10%4=2; etc.
24th Nov 2016, 12:41 PM
Arun Vishwakarma
Arun Vishwakarma - avatar
+ 3
it always gives a positive number as remainder like 27%5=2 as 5*5=25 and 27-25=2 where 2 is a remainder
22nd Dec 2016, 10:21 AM
Sumit Lokhande
Sumit Lokhande - avatar
+ 3
10 % 2 == 5 It means When 10 is divided by 2 , It gives 0 as Remainder. Basically '/' Stands for Quotient '%' Stands for Remainder.
22nd Dec 2016, 5:54 PM
SUMANTH VENKATA SAI KRISHNA Manduru
SUMANTH VENKATA SAI KRISHNA Manduru - avatar
+ 3
%>the remainder.... its not like normal arithmetic math... 5/2=2.5...5 is the ans....
22nd Dec 2016, 8:58 PM
Seth
Seth - avatar
+ 3
% remains the remainder of the division 9%3=0 9%4=1
22nd Dec 2016, 9:04 PM
Ashutosh Saraf
Ashutosh Saraf - avatar
+ 3
IT IS EASY TO UNDERSTAND..... EXAMPLE = ((int x; x = 6%3; cout<<x<<endl;)) in this ............. 6 divides with 3 as we know that 3*2 = 6 so their is no remainder hence the output will be = 0 ******__________________****** /*IT MEANS THAT "MODULO(%)" MEANS HOW MUCH IS THE REMAINDER WHEN A NUMBER IS DIVIDED WITH OTHER/*
24th Mar 2017, 3:14 PM
🎆Sourav Subhakant Dash🔥🔥
🎆Sourav Subhakant Dash🔥🔥 - avatar
+ 2
it does not work with negative integers
9th Nov 2016, 2:06 PM
Firas Omrane
Firas Omrane - avatar
+ 2
meaning of % this symbol is reminder example :. 9/3 where %=0 19/3 where %=1
14th Nov 2016, 7:16 AM
veera
veera - avatar
+ 2
it gives you the remainder when you divide
24th Nov 2016, 2:29 PM
zaki mohamud
zaki mohamud - avatar
+ 2
% returns the remainder suppose 9%3 will give you 0 as answer because when we divide 9 by 3 no remainder remain hence answer will be zero.
22nd Dec 2016, 10:17 AM
Munna Singh
+ 2
Ok, lets say you have 18/4, how do you do this ? without , ! 18 / 4 = 4 * 4 + 2 ! 18%4=2 780 / 3 = 250 * 3 + 30. 780%3=30
22nd Dec 2016, 12:27 PM
SKREFI
SKREFI - avatar
+ 2
Division and Remainders Sometimes when dividing there is something left over. It is called the remainder. Example: There are 7 bones to share with 2 pups. But 7 cannot be divided exactly into 2 groups, so each pup gets 3 bones, but there will be 1 left over "7 divided by 2 equals 3 with a remainder of 1" 7%3=1 <cite>https://www.mathsisfun.com/numbers/division-remainder.html</cite>
22nd Dec 2016, 4:25 PM
Didi Georgel Danaila
Didi Georgel Danaila - avatar
+ 2
HELLOOOOOOOOOOOOOOO!!!! IT IS ALREADY EXPLAINED SEVERAL TIMES. CLOSEDDDDDD!!!!!!
22nd Dec 2016, 4:53 PM
Iván
Iván - avatar
+ 2
% is called Modulus. It is used to get the remainder of the division. Example: 1). 10%3=1 1 is the answer since 1 is the remainder. 2). 10%4=2 3). 50%9=5 Ps.I hope you understand
6th Feb 2017, 9:13 AM
Ellaine Joyce Sorbito
Ellaine Joyce Sorbito - avatar
+ 1
Got it. It that nuber that left after max devision?
31st Oct 2016, 11:51 AM
Sergei Belialov
Sergei Belialov - avatar