Answer to Question #297112 in C++ for junior

Question #297112

Write a program that uses loops to print out a design of following using asterisks:

* * * * *

* *

* * * * *

* * * * *

* *

* * * * *


* * * * *

* * * * *


* * * * *

* * * * *

The program should only use the following print statements:

print(“* * * * *”)

print(“* *”)

print(“\n”)


1
Expert's answer
2022-02-14T06:37:49-0500
#include<iostream>

using namespace std;

int main()
{
	for(int i=0;i<12;i++)
	{
		if(i==1||i==4)
			printf("**");
		else if(i==6||i==9){}
		else
			printf("*****");
		printf("\n");
	}
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog