+ 2
How to create the following design using nested loops & & & & & & & & & & & & & & & & & & & &
Please help me!!!!!!
6 Answers
+ 7
#include <iostream>
using namespace std;
int main()
{
int n, i, j;
cout << "Insert number: ";
cin >> n;
for(i=0;i<n;i++) {
if(i==0){
for(j=0;j<n-1;j++)
cout<<" ";
cout<<"&\n";
}
else if(i==n-1){
for(j=0;j<n*2-1;j++)
cout<<"&";
}
else{
for(j=0;j<n-i-1;j++)
cout<<" ";
cout<<"&";
for(j=0;j<i*2-1;j++)
cout<<" ";
cout<<"&\n";
}
}
return 0;
}
+ 4
#include <iostream>
using namespace std;
int main()
{
int n, i, j;
cout << "Insert number: ";
cin >> n;
for(j=0;j<n-1;j++)
cout<<" ";
cout<<"&\n";
for(i=0;i<n-2;i++) {
for(j=0;j<n-i-2;j++)
cout<<" ";
cout<<"&";
for(j=0;j<1+(2*i);j++)
cout<<" ";
cout<<"&\n";
}
for(j=0;j<n*2-1;j++)
cout<<"&";
return 0;
}
- 2
eldxtxxrlllzeez
- 2
eldxtxxrlllzeez lol l
- 2
eldxtxxrlllzeez lol l
- 2
eldxtxxrlllzeez lol l