Suggestion-Box icon indicating copy to clipboard operation
Suggestion-Box copied to clipboard

Multiplication without using "*".

Open TejasIsCool opened this issue 4 years ago • 5 comments

For a quick Coding challange, you can try doing Multiplication without using the multiply operator, or any thing that multiplies for you. Since this is quite simple, you can try for floating numbers as well.

TejasIsCool avatar Oct 15 '21 14:10 TejasIsCool

This is not restrictive enough. As a / (1/b) === a * b Therefore you could just let answer = a / (1/b).

winstonDeGreef avatar Jul 04 '22 00:07 winstonDeGreef

This is not restrictive enough. As a / (1/b) === a * b Therefore you could just let answer = a / (1/b).

Alright, doing multiplication without using the "*" symbol, or the "/" symbol, or using anything that uses * or / to do any calculation.

TejasIsCool avatar Jul 04 '22 00:07 TejasIsCool

This is not restrictive enough. As a / (1/b) === a * b Therefore you could just let answer = a / (1/b).

Alright, doing multiplication without using the "*" symbol, or the "/" symbol, or using anything that uses * or / to do any calculation.

It makes more sense to limit it to the + and - operations. That way there is no way to use some built in function.

winstonDeGreef avatar Jul 04 '22 13:07 winstonDeGreef

Isn't it simple enough like, a*b simply means "a added b number of times" so one could easily use a loop and + operator to get the job done.

bit-shashank avatar Jul 17 '22 07:07 bit-shashank

Isn't it simple enough like, a*b simply means "a added b number of times" so one could easily use a loop and + operator to get the job done.

True, but that doesn't exactly work the same for floating point numbers. That's the coding challenge idea to figure a way out for decimals.

TejasIsCool avatar Jul 17 '22 07:07 TejasIsCool