What's the operators of remainder?



How to distingush odd numbers from even numbers?
Like the following operator in JAVA language:

dicision:input numbers % 2 == 0
True:even numbers
False: odd numbers


IntNumber mod 2

with example




I want to find the quotient and remainder of a number , how would that be possible ?
Suppose if the number is 100 and I divide it by 60 then I want quotient as 1 and remainder 40??


Hey @ashutoshkhantwal

Try this:

double input_number= 100;

int remainder = input_number mod 60;

double quotient = input_number / 60;



Hello Aksh,
Well in my case I have the input as a generic variable , so can I convert it to a double?
Also using this I will get both the values of remainder and quotient as same, i.e. 40 .


Hey @ashutoshkhantwal

Yes change datatype to System.double to get floating point values as well.

just use as it is:
int remainder = input_number mod 60;

int quotient = input_number / 60

or still facing error then show your sample.



There is an error for type conversion.


Hey @ashutoshkhantwal

Less time… meanwhile check a quick sample for you.

just convert the type of second variable to system.double. the error will be gone.
if you want integer then convert it to int and then assign but keep in mind after conversion you will get the round value.
like for 1.66 you will get 2. and for 1.45 you will get 1.

remainder.xaml (6.0 KB)



Hey Aksh, thanks but the second value is coming out too be 1.6777 whereas it should be 1 since the remainder is 40.


Well if you always want a floor value then use Math.Floor().

Sample:-remainder.xaml (6.1 KB)