Pattern Displays Write a program that uses either a while or do while loop to di
ID: 1833938 • Letter: P
Question
Pattern Displays
Write a program that uses either a while or do while loop to display Pattern A below, followed by another loop that displays Pattern B.
Pattern A
+
++
+++
++++
+++++
++++++
++++++++
+++++++++
++++++++++
Pattern B
++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+
here's the code with for loops. I get stuck trying to flip it over to a while or do while loop
#include<iostream>
using namespace::std;
int main(){
int n;
cout<<"Enter the triangle's dimensions ";
cin>>n;
for (int i = 1 ; i <= n ; i++){
for (int j=1; j<=i ; j++){
cout<<"*";
}//end for
cout<<" ";
}//end for
cout<<" ";
for(int i=n; i>=1; i--){
for(int j=i; j>=1; j--){
cout<<"*";
}//end for
cout<<" ";
}//end for
return 0;
}//end main