Write a program C++ that receives an integer from the user and then prints the \
ID: 3662773 • Letter: W
Question
Write a program C++ that receives an integer from the user and then prints the "*" as in the attached picture Note : The number of "*" in the first line is the last one in line is the same number the entrance incrementally in each line using the comands ( do, while, cin, cout, using namespace std, int main) example below photo
example of a past HW
I need same comands as this
#include <iostream>
using namespace std;
int number;
int main() {
do
{
cout<<"Enter new Number: ";
cin>>number;
}
while(number!=99);
cout<<"stopping number is 90";
return 0;
}
Explanation / Answer
As per given problem and sampled code updated the code to print the stars in a patteren as given in sampled
ouput. this below c++ code will do the operation.
See the below code
#include <iostream>
using namespace std;
int main()
{
int number,c, k;
cout<<"Enter number of rows"<<endl;
cin>>number;
for ( c = 1 ; c <= number ; c++ )
{
for( k = 1 ; k <= c ; k++ )
cout<<"*";
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.