Showing posts with label pattern. Show all posts
Showing posts with label pattern. Show all posts

Monday, September 19, 2016

GREEN Matrix Pattern

Program to Display Infinite GREEN Matrix Pattern.

#include <iostream>
#include<stdlib.h>
using namespace std;
int main()
{

    system("COLOR A");   //Function for GREEN Textcolor

start:
    int x;
    cout<<x;
    goto start;

}

You can STOP the Pattern by Pressing CTRL+Break Keys.


You Can Also Choose From The Following Color Codes:
Color Codes:
0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White


Also SEE Number Pattern Click here

Wednesday, September 7, 2016

Pattern: "Triangle of stars" :)

#include<stdio.h>
#include<conio.h>
main()
{
      int i,j,n; //variable declaration
      printf("Enter number of lines to be used in pattern: "); //telling the user to enter number of rows
      scanf("%d",&n);// taking in value from user
      for(j=0;j<=n;j++) // tells number of rows
      {
                       for(i=1;i<=j;i++) //decides number of stars in a row
                       {
                                        printf("*");//printing pattern
                                        }
                                        printf("\n");//used for jumping into next row
                                        }
                                        getch();
                                        }
   Also see program to delete a node from a linklist

PROGRAM TO PRINT A DIAMOND OF STARS:
#include<iostream>
using namespace std;
main()
{
int n,j,i,c;
cout<<"ENTER THE NO OF ROWS";
cin>>n;
c=n-1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c--;
for(j=1;j<=2*i-1;j++)
cout<<"*";
cout<<"\n";
}
c=1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c++;
for(j=1;j<=2*(n-i)-1;j++)
cout<<"*";
cout<<"\n";
}

}

Monday, September 5, 2016

PROGRAM TO PRINT THE FOLLOWING PATTERN:

PROGRAM TO PRINT THE FOLLOWING PATTERN:
6
65
654
6543
65432
654321

#include <iostream>
using namespace std;
int main()
{
int i,j,n;
cout<<"Enter Length of Pattern: ";
cin>>n;
cout<<"\nPattern is:\n";
for(i=n;i>=1;i--)
{
for(j=n;j>=i;j--)
cout<<j;
cout<<endl;
}
return 0;
}





PROGRAM TO DISPLAY STAR TRIANGLE PATTERN:

PROGRAM TO DISPLAY  STAR TRIANGLE PATTERN  IN AN ARRAY

#include <iostream>
using namespace std;
int main()
{
    int i,j,n;
    cout<<"Enter Length of Pattern: ";
    cin>>n;
    cout<<"\nPattern is:\n";

    for(i=n; i>=1; i--)
    {
        for(j=n; j>=i; j--)
            cout<<"*";
        cout<<endl;
    }
    return 0;
}


Friday, September 2, 2016

PROGRAM TO PRINT THE FOLLOWING PATTERN
1
22
333
4444
55555

:
#include<iostream>
using namespace std;
class pattern
{
int i,j;
public:
void patt()
{
for(i=1;i<6;i++)
{for(j=1;j<=i;j++)
cout<<i;
cout<<"\n";
}
 
}

};
main()
{pattern p;
p.patt();
}