Q.No. - Write a Python program to multiply two numbers by repeated addition. Example: 6*3=6+6+6
Sol.-
a=int(input("Enter your number"))
b=int(input("Enter by which multiply"))
c=0
for i in range(0,b):
c=c+a
print(c)
Explain :
Step 1: Here we decalre two variables a and b which take input from user.
Step 2: C variable which is 0.
Step 3: Use for loop (0,b) - means the range start from 0 and stop to b. So this loop run depend upon b value.
Step 4: c value change according to given no. and at the end we print c value which is come us by sum of c+a.