# Program That Reads 2 Positive Integer And Print The First Multiples Of It Only Using "while"

## 17 March 2019 - 1 answer

I'm trying to write a program that reads 2 positive integers (m and n), and then print the n first positive integers of m using only while loop.

Here is the original question

Write a program in the Python 3.x language that reads two positive integers, m and n, and print the first n positive integers that are multiples of m.

And the output of the code should look like:

``````Type a positive integer for m: 9
Type a positive integer for n: 5
The first 5 positive integers multiples of 9 are:
9
18
27
36
45
``````

So I have done so far:

``````m = int(input("Type a integer for m: "))
n = int(input("Type a integer for n: "))
i = 1
print()
print("The first ",n,"positive integers multiples of ", m," are:")
while i <= n:
m = m * i
print(m)
i = i + 1
``````

I wanna understand how to fix this one and I realize that using for or if it's gonna be easier to do that

Nullman's asnwer is the right one, anyways here is your code corrected, just in case it may help you understand better the error:

``````m = 9
n = 5
i = 1
print()
print("The first ",n,"positive integers multiples of ", m," are:")
while i <= n:
multiple = m * i
print(multiple)
i = i + 1
``````

You cannot use `if`, but you could indeed use `for`:

``````m = 9
n = 5
i = 1
print()
print("The first ",n,"positive integers multiples of ", m," are:")
for i in range(1, n + 1):
multiple = m * i
print(multiple)
i = i + 1
``````