a) write c++ program using nested while loops that will print thefollowing *****
ID: 3617527 • Letter: A
Question
a) write c++ program using nested while loops that will print thefollowing *************
*****
****
***
**
* b) modify the program code of part that now it should asked theuser how many lines of the figure you want to print and it shouldprint the lines of * upto the digit entered by theuser ( the maximum lines user can input is 20) a) write c++ program using nested while loops that will print thefollowing *******
******
*****
****
***
**
* b) modify the program code of part that now it should asked theuser how many lines of the figure you want to print and it shouldprint the lines of * upto the digit entered by theuser ( the maximum lines user can input is 20) b) modify the program code of part that now it should asked theuser how many lines of the figure you want to print and it shouldprint the lines of * upto the digit entered by theuser ( the maximum lines user can input is 20)
Explanation / Answer
Dear User, a) #include<iostream> using namespace std; void main( ) { int n=7; int i=n,j; //Loop variable while(i >=1) { j=1; while(j<=i) {cout<<"*"; j++; } cout<<" "; i--; } //pause system for a while system("pause"); } b) #include<iostream> using namespace std; void main( ) { int Lines; inti,j; //Loop variable //inputting lines cout<<"Enter number oflines:"; cin>>Lines; if(Lines>20) { cout<<"Enter numberof lines can be maximum of 20:"; cin>>Lines; } i=Lines; while(i>=1) { j=1; while(j<=i) {
cout<<"*"; j++; } cout<<" "; i--; } //pause system for a while system("pause"); } ITS HELPFUL TO YOU.... } ITS HELPFUL TO YOU....
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.