print x copies of the value of x followed by y copies of the value of message. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

print x copies of the value of x followed by y copies of the value of message.

int x,y; string name, message;

7th Oct 2016, 8:13 PM
Steven Cai
Steven Cai - avatar
2 Answers
+ 2
You can do this easy with for loops: //print value of x, x times. for (int i = 0; i < x; i++) cout << x << "\n"; //print message, y times. for (int j = 0; j < y; j++) cout << message << "\n";
8th Oct 2016, 1:52 AM
Cohen Creber
Cohen Creber - avatar
- 2
Kthxbye
7th Oct 2016, 8:59 PM
Xaviera Yayaell
Xaviera Yayaell - avatar