human
Print all numbers that can be obtained by adding A or B to N exactly M times | Function to find all possible numbers that can be obtained by adding A or B to N exactly M times.
For maintaining increasing order.
Smallest number that can be achieved.
If A and B are equal , the only number that can be onbtained is N + M * A.
For finding other numbers , subtract A from number 1 time and add B to number 1 time.
Driver Code.
Given Input.
Function Call"
Solution in Python:
 Can you provide a code to print all numbers that can be obtained by adding A or B to N exactly M times and the other steps required?
assistant
#Here is code to print all numbers that can be obtained by adding A or B to N exactly M times and the other steps required.
 def possibleNumbers ( N , M , A , B ) :
	if ( A > B ) :
		temp = A
		A = B
		B = temp
	number = N + M * A
	print ( number , end = " ▁ " )
	if ( A != B ) :
		for i in range ( M ) :
			number = number - A + B
			print ( number , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	N = 5
	M = 3
	A = 4
	B = 6
	possibleNumbers ( N , M , A , B )