Write an algorithm/code in C to do integer multiplication and division without using multiplication nor division operators. Do the same thing for partitioned algorithm/parallelizable (suitable in parallel processing)
Anónimo
The simplest way: int c = a*b c = 0; if ((a==0) || (b == 0) c = 0; if (a==1) c = b; else if (b==1) |c = a else for(i=0; i> 1; for(i=0; i>1); if (y % 2 == 0) return z<<1; else { return x + (z<<1); } } THere are other methods, though. Anybody can answer?