Computer Science, asked by amisha287287, 2 months ago

Question List
Order the algorithm to find the modulo of any two given
numbers
1.
Declare 3 variables - multiplier & multiplicand and resultant_modulo
2.
Read the values of multiplier and multiplicand
3.
resultant_ modulo = multiplier % multiplicand
4.
Display the resultant_modulo

Answers

Answered by nive1798
26

Answer:

option 1 declare 3 variables- nultiplier &multiplicand and

Answered by shilpa85475
0

Modulo is nothing but the value of the remaining number that is left when a number is divided by another value. The algorithm is given below:

class abc

{

static long modulo Multiplication (long a,

long b, long mod)

{

long res = 0;  

a %= mod;

while (b > 0)

{

if ((b & 1) > 0)

{

res = (res + a) % mod;

}

a = (2 * a) % mod;

b >>= 1; // b = b / 2

}

return res;

}

public static void main(String[] args)

{

long a = 10123465234878998L;  

long b = 65746311545646431L;

long m = 10005412336548794L;

System.out.print(moduloMultiplication(a, b, m));

}

}

Similar questions