Friday, April 3, 2020

C/C++ PATTERNS

Today we will see how to print square box type patterns (SOLID)


PROBLEM 1 : 

the code goes here

#include<iostream>
using namespace std;
int main()
{
int i,j,n=6;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cout<<" "<<"*";
}
cout<<endl;
}
}




PROBLEM 2 : 




the code goes here



#include<iostream>
using namespace std;
int main()
{
int i,j,n=6;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cout<<" "<<i;
}
cout<<endl;
}
}





PROBLEM 3 :  




the code goes here


#include<iostream>
using namespace std;
int main()
{
int i,j,n=6;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cout<<" "<<j;
}
cout<<endl;
}
}






PROBLEM 4 : 



the code goes here



#include<iostream>
using namespace std;
int main()
{
int i,j,n=6;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cout<<" "<<6-i;
}
cout<<endl;
}
}






PROBLEM 5 : 



the code goes here



#include<iostream>
using namespace std;
main()
{
char i,j;
for(i='A';i<='F';i++)
{
for(j='A';j<='F';j++)
{
cout<<" "<<char(i);
}
cout<<endl;
}
}







PROBLEM 8 : 



the code goes here


#include<iostream>
using namespace std;
main()
{
char i,j;
for(i='A';i<='F';i++)
{
for(j='A';j<='F';j++)
{
cout<<" "<<char(j);
}
cout<<endl;
}
}






No comments:

Post a Comment