Answer to Question #272641 in C++ for Hamda

Question #272641

Use nested While loops to produce the following pattern:



! ! ! ! ! ! ! ! ! ! ! !


\ \ ! ! ! ! ! ! ! ! / /


\ \ \ \ ! ! ! ! / / / /


\ \ \ \ \ ! ! / / / / /

1
Expert's answer
2021-12-01T06:41:57-0500
#include <iostream>
using namespace std;


int main()
{
   int i=1;
   while(i<=12){
   	cout<<"!";
   	i++;
   
   }
   
   cout<<"\n";
   int j=1;
   while(j<=12){
   	if(j<=2)
   	{
   		cout<<"\\";
	   }
	   else if(j>10){
	   	cout<<"/";
	   }
	   else
   	cout<<"!";
   	j++;
   }
   
   cout<<"\n";
   int k=1;
   while(k<=12){
   	if(k<=4)
   	{
   		cout<<"\\";
	   }
	   else if(k>8){
	   	cout<<"/";
	   }
	   else
   	cout<<"!";
   	k++;
   }
   
    cout<<"\n";
   int l=1;
   while(l<=12){
   	if(l<=5)
   	{
   		cout<<"\\";
	   }
	   else if(l>7){
	   	cout<<"/";
	   }
	   else
   	
   	cout<<"!";
   	l++;
   }
   return 0;
}

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
APPROVED BY CLIENTS