Use nested While loops to produce the following pattern:
! ! ! ! ! ! ! ! ! ! ! !
\ \ ! ! ! ! ! ! ! ! / /
\ \ \ \ ! ! ! ! / / / /
\ \ \ \ \ ! ! / / / / /
#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;
}
Comments