- 1
Write a program that reads in numbers m, n and prints the letter X (capital X) m times
Write a program that reads in numbers m, n and prints the letter X (capital X) m times followed by the letter Y (capital Y) n times, all in one line.
3 Réponses
- 3
#include <iostream>
using namespace std;
int main() {
int m,n;
cin>>m>>n;
while(m--)
cout<<"X";
while(n--)
cout<<"Y";
return 0;
}
0
Okay, then write a program?
If you need help, please link your code
0
#include <iostream>
Using namespace std;
int main()
{
int m,n;
cin>>m>>n;
int i;
for (i=1;i<=m;i++)
cout<<"X";
cout<<" ";
for(i=1;i<=n;i++)
cout<<"Y";
return 0;
}