76 800
Assignments Done
Successfully Done
In June 2019

Answer to Question #8342 in C++ for Jason

Question #8342
Concerning star patterns: I understand how to print a quantity of lines (containing an equivalent quantity of stars (or other characters), however how would I be able to print a selective number of stars in each line? In other words, the program will first ask the user to enter the total number of stars/characters to be displayed, and then it will repeatedly display the above pattern until the exact number is displayed (for example: input '6' as total number, and the program will print:
Expert's answer
#include "iostream.h"

void main(){
int n;
cout<<"Enter a number: ";
int k=1;
while (k<=n){
& for (int i=1;i<=k;i++) cout<<"*";
& cout<<"\n";
& k++;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions