Reverse Program

Reverse

The following program takes 2 integer inputs and uses while loops to generate the outputs.

Try recreating the program to match the input and outputs.

Example

3 9
9 9 9

5 2
2 2 2 2 2

8 1
1 1 1 1 1 1 1 1

Answer

#include <iostream>
using namespace std;

int main() 
{
	int input1, input2;
	std::cin >> input1 >> input2;

	int counter = 0;
	while (counter < input1)
		std::cout << input2 << " ";
}
Questions