Hello All. I would like help with this program in C++ if it is possible: Create
ID: 3565616 • Letter: H
Question
Hello All.
I would like help with this program in C++ if it is possible:
Create a program which uses a total of 3 FOR loops, you can not use more than 3 loops in this program.
What I have got so far is:
#include<iostream>
using namespace std;
int main(){
int x,y;
char star = '*';
for(x=1; x <= 11; x++){
if((x%6) != 0){
for(y=1; y <= x ; y++){
cout << star;
}
cout << endl;
}
}
return 0;
}
The output should look like this:
*
**
***
****
*****
******
*******
********
*********
**********
*
**
***
****
*****
******
*******
********
*********
**********
I appreciate any kind of help. Thank you!
Explanation / Answer
// Code available at http://ideone.com/zll9jg
#include<iostream>
using namespace std;
int main(){
int x,y,i;
char star = '*';
for(i=1;i<=2;i++)
{
for(x=1;x<=10;x++)
{
for(y=1;y<=x;y++)
{
cout<<star;
}
cout<<endl;
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.