multiplication

How do you multiply using while without using multiplication? [closed]

 ̄綄美尐妖づ 提交于 2020-08-03 11:34:08
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Improve this question I want to know how to get the product of two integers using only the addition or subtraction operators and without using the division and multiplication. If you could add the while statement that would be helpful. A Basically, I want to know how to add a

How do you multiply using while without using multiplication? [closed]

試著忘記壹切 提交于 2020-08-03 11:33:59
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Improve this question I want to know how to get the product of two integers using only the addition or subtraction operators and without using the division and multiplication. If you could add the while statement that would be helpful. A Basically, I want to know how to add a

How do you multiply using while without using multiplication? [closed]

老子叫甜甜 提交于 2020-08-03 11:33:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Improve this question I want to know how to get the product of two integers using only the addition or subtraction operators and without using the division and multiplication. If you could add the while statement that would be helpful. A Basically, I want to know how to add a

Regex multiplication

萝らか妹 提交于 2020-07-16 06:00:08
问题 looked around for a while before I asked but I seem to find a lot of how to's on email and currency conversion using regex but nothing on just multiplying a number with a set value. Essentially, I have a currency value field of lets say: 127.25GBP which needs to be converted to 165.42 (only two decimal points and no currency indicator) Can that be done and if yes how? Your help would be greatly appreciated! Thanx Del 回答1: Regular expressions are intended for text-matching, not arithmetics.

Cumulative product of a list

喜你入骨 提交于 2020-07-01 16:13:31
问题 I have implemented a list of all prime numbers from a set amount. What I'm trying to do is hard to explain so I'll just show it with some hard code: euclst = [] euclst.append((primelst[0]) + 1) euclst.append((primelst[0] * primelst[1]) + 1) euclst.append((primelst[0] * primelst[1] * primelst[2]) + 1) .... So essentially I'm trying to take a single element in order from my prev list and multiplying it exponentially I guess and appending it to my other list. I realized that I could just do this

How do you multiply two fixed point numbers?

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-15 06:21:06
问题 I am currently trying to figure out how to multiply two numbers in fixed point representation. Say my number representation is as follows: [SIGN][2^0].[2^-1][2^-2]..[2^-14] In my case, the number 10.01000000000000 = -0.25 . How would I for example do 0.25x0.25 or -0.25x0.25 etc? Hope you can help! 回答1: Multiply into a larger sized variable, and then right shift by the number of bits of fixed point precision. 回答2: You should use 2's complement representation instead of a seperate sign bit. It

Multiplying 32 bit two numbers on 8086 microprocessor

僤鯓⒐⒋嵵緔 提交于 2020-03-16 07:25:57
问题 I have code example for multiplying two 16 bit numbers on 8086 and trying to update it for two 32 bit numbers multiplying. start: MOV AX,0002h ; 16 bit multiplicand MOV BX,0008h ; 16 bit multiplier MOV DX,0000h ; high 16 bits of multiplication MOV CX,0000h ; low 16 bits of multiplication MOV SI,10h ; loop for 16 times LOOP: MOV DI,AX AND DI,01h XOR DI,01h JZ ADD CONT: RCR DX,1 RCR CX,1 SHR AX,1 DEC SI CMP SI,0 JNZ LOOP JMP END ; ignore here, it's not about multiplication. ADD: ADD DX,BX JMP

lovely-lucky-lambs last test case not passing

[亡魂溺海] 提交于 2020-02-23 07:18:21
问题 I am being very late to the google foobar party. I am stuck at level 2, and only the last test case is pending. But I am completely clueless of what this question is expecting in this last test case. I googled the question and looks like they've updated the test case and the constraint of lambs < 10 has been removed. Question is: Lovely Lucky LAMBs Being a henchman isn't all drudgery. Occasionally, when Commander Lambda is feeling generous, she'll hand out Lucky LAMBs (Lambda's All-purpose

Unexpected update result on the quickly nested list in Python [duplicate]

十年热恋 提交于 2020-01-30 12:06:04
问题 This question already has answers here : List of lists changes reflected across sublists unexpectedly (13 answers) Closed 2 years ago . Why couldn't the first element but the whole column be updated below? >>> x=2*[2*[1]] >>> x [[1, 1], [1, 1]] >>> x[0][0]=2 >>> x [[2, 1], [2, 1]] 回答1: Even tho this is a clear duplicate but use range : >>> x=[[1 for i in range(2)] for x in range(2)] >>> x [[1, 1], [1, 1]] >>> x[0][0]=2 >>> x [[2, 1], [1, 1]] >>> At least still able to do: >>> x=[[1]*2 for x

Unexpected update result on the quickly nested list in Python [duplicate]

一世执手 提交于 2020-01-30 12:04:47
问题 This question already has answers here : List of lists changes reflected across sublists unexpectedly (13 answers) Closed 2 years ago . Why couldn't the first element but the whole column be updated below? >>> x=2*[2*[1]] >>> x [[1, 1], [1, 1]] >>> x[0][0]=2 >>> x [[2, 1], [2, 1]] 回答1: Even tho this is a clear duplicate but use range : >>> x=[[1 for i in range(2)] for x in range(2)] >>> x [[1, 1], [1, 1]] >>> x[0][0]=2 >>> x [[2, 1], [1, 1]] >>> At least still able to do: >>> x=[[1]*2 for x