1. Engineering
  2. Computer Science
  3. im trying to multiply two numbers in python without using...

Question: im trying to multiply two numbers in python without using...

Question details

I'm trying to multiply two numbers in Python without using the * operand. I have the code working for entering two positive numbers and a positive and negative number but it does not work when multiplying two negative numbers. Any thoughts on how to fix this?

Here is the code:

#input two numbers to multiply m- int (input (First Number:) n- int (input (Second number:)) Setting coutner to 0 gives a starting palce for values to begin MyProduct-0 for i in range (n): MyProduct+-m the for loop will take n values and add them up until it equals the same number of m values print (The product for,m, and,n, is,MyProduct)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution