0% found this document useful (0 votes)
3 views14 pages

Patterns Programs in C++

The document contains multiple C++ programs prepared by Prof. Anushree K. Rewale that demonstrate various patterns using loops and console output. Each program illustrates different ways to print stars and spaces in a formatted manner. The code snippets include nested loops and comments indicating where to replace placeholders with variables.

Uploaded by

soham patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views14 pages

Patterns Programs in C++

The document contains multiple C++ programs prepared by Prof. Anushree K. Rewale that demonstrate various patterns using loops and console output. Each program illustrates different ways to print stars and spaces in a formatted manner. The code snippets include nested loops and comments indicating where to replace placeholders with variables.

Uploaded by

soham patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Patterns Programs Prepared by Prof.

Anushree

K. Rewale

***** #include <iostream>


***** using namespace std;
*****
int main() {
*****
int i,j;
*****
11111
for(i = 1; i <= 5; i++)
22222
{
33333
44444 for(j = 1; j <= 5; j++)
55555 {
cout<<" * "; //replace " * " with i & j variable }
12345
cout<<"\n";
12345
12345 }
12345 return 0;
12345 }
Prepared by Prof. Anushree K. Rewale
* #include <iostream>
** using namespace std;
***
int main() {
****
int i,j;
*****
for(i = 1; i <= 5; i++)
1 {
22 for(j = 1; j <= i; j++)
333
{
4444
55555 cout<<“ * "; //replace " * " with i & j variable }
1 cout<<"\n";
12 }
123
return 0;
1234
12345 }
Prepared by Prof. Anushree K. Rewale

***** #include <iostream>


**** using namespace std;
***
int main() {
**
int i,j;
*
11111
for(i = 1; i <= 5; i++)
2222
{
333
44 for(j = 5; j >= i; j--)
5 {
cout<<“ * "; //replace " * " with i & j variable }
54321
cout<<"\n";
5432
543 }
54 return 0;
5 }
Prepared by Prof. Anushree K. Rewale
* #include<iostream>
** using namespace std;
int main()
*** {
**** int i, j, k;
***** for(i = 1; i <= 5; i++)
{
/* Print spaces in decreasing order of row */
1 for(j = i; j < 5; j++)
22 {
333 cout<<" ";
4444 }
/* Print star in increasing order or row */
55555
1 for(k = 1; k <= i; k++)
12 {
cout<<"*"; //replace " * " with i & k variable
123 }
1234 /* Move to next line */
12345 cout<<"\n";
}
return 0;
}Prepared by Prof. Anushree K. Rewale

***** #include<iostream>
**** using namespace std;
int main()
*** {
** int i, j, k;
* for(i = 1; i <= 5; i++)
{
11111 /* Print spaces in increasing order of row */
2222 for(j = 1; j < i; j++)
{
333 cout<<" ";
44 }
5 /* Print star in decreasing order or row */
for(k = 5; k >= i; k--)
{
54321 cout<<"*"; //replace " * " with i & k variable
5432 }
543 /* Move to next line */
54 cout<<"\n";
}
5 return 0;
}Prepared by Prof. Anushree K. Rewale
* #include<iostream>
using namespace std;
***
int main()
***** {
******* int i, j, k;
for(i = 1; i <= 5; i++)
*********
{
/* Print spaces in decreasing order of row */
1 for(j = i; j < 5; j++)
222 {
33333 cout<<" ";
4444444 }
/* Print star in increasing order or row */
555555555
1 for(k = 1; k < (i*2); k++)
123 {
cout<<"*"; //replace " * " with i & k variable
12345 }
1234567 /* Move to next line */
123456789 cout<<"\n";
}
return 0;
}Prepared by Prof. Anushree K. Rewale

*********** #include<iostream>
***** using namespace std;
int main()
***** {
*** int i, j, k;
for(i = 5; i >= 1; i--)
*
{
55555555544 /* Print spaces in increasing order of row */
44444 for(j = 5; j > i; j--)
{
33333 cout<<" ";
222 }
1 /* Print star in decreasing order or row */
for(k = 1; k < (i*2); k++)
{
12345678912 cout<<"*"; //replace " * " with i & k variable
34567 }
12345 /* Move to next line */
123 cout<<"\n";
}
1 return 0;
}Prepared by Prof. Anushree K. Rewale
* #include<iostream>
** using namespace std;
int main()
***
{
**** int i, j, k;
***** for(i = 1; i <= 5; i++)
{
1 for(j = i; j < 5; j++)
{
22 cout<<" ";
333 }
4444 for(k = 1; k <= i; k++)
55555 {
1 cout<<"*"; //replace " * " with i & k variable
12 cout<<" ";
}
123
cout<<"\n";
1234 }
12345 return 0;
}
Prepared by Prof. Anushree K. Rewale

********* #include<iostream>
*** using namespace std;
int main()
**
{
* int i, j, k;
for(i = 1; i <= 5; i++)
111112222 {
333 for(j = 1; j < i; j++)
{
44
cout<<" ";
5 }
for(k = 5; k >= i; k--)
{
543215432 cout<<"*"; //replace " * " with i & k variable
cout<<" ";
543 }
54 cout<<"\n";
5 }
return 0;
}
Prepared by Prof. Anushree K. Rewale

You might also like