1
I have to develop a sum multiplication algorithm for any integer in the most optimized way possible.
I thought the following: x*y=z;x,y
belongs to the whole, so z=x+x y
times. I know practically nothing of programming, but I managed to get on these lines:
n1 = int(input('Digite um número'))
n2= int(input('Digite um número'))
multiplicação = (n1 + n1) range (n2)
print("A multiplicação de", n1, "(n1 + n1) range (n", n2, "eh igual a", multiplicação)
My problem is I can’t define the law of multiplication as n1+n1 n2
times. I need someone to give me a light in this aspect, just need this definition. The calculation should still be done in the most optimized way possible ex:
5.2=5+5
nay:
5.2=2+2+2+2+2
If anyone has any idea of that too I would be extremely grateful.
Possible duplicate of Python sum multiplication algorithm
– Costamilam
I re-asked my question, that wasn’t well asked,I just need the transcription of n1+n1 N2 times for python.
– Magliari
Take a look at this link.
– Solkarped