Showing posts with label Pattern. Show all posts
Showing posts with label Pattern. Show all posts

Program to display the following pattern: 1 12 123 1234 12345

Write a C++ Program to Display the Following Pattern.


/* Program to display the following pattern:
1
12
123
1234
12345
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
cout<<j;
cout<<endl;
}
getch();
}

Program to display the following pattern: * ** *** **** *****

Write a C++ Program to Display the Following Pattern.



/* Program to display the following pattern:
    *
   **
  ***
 ****
*****
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1;i<=5;i++)
{
for(int j=4;j>=i;j--)
cout<<" ";
for(int k=1;k<=i;k++)
cout<<"*";
cout<<endl;
}
getch();
}

Program to display the following pattern: ********** ********** **********

Write a C++ Program to Display the Following Pattern.



/* Program to display the following pattern:
**********
**********
**********
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1;i<=3;i++)
{
for(int j=1;j<=10;j++)
cout<<"*";
cout<<endl;
}
getch();
}

Program to display the following pattern: * *** ***** ******* *********

Write a C++ Program to Display the Following Pattern.



/* Program to display the following pattern:
    *
   ***
  *****
 *******
*********
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1,l=4;i<=9;i+=2,l--)
{
for(int j=1;j<=l;j++)
cout<<" ";
for(int k=1;k<=i;k++)
cout<<"*";
cout<<endl;
}
getch();
}

Program to display the following pattern: 1 222 33333 4444444 555555555

Write a C++ Program to Display the Following Pattern.



/* Program to display the following pattern:
    1
   222
  33333
 4444444
555555555
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1,l=4,m=1;i<=9;i+=2,l--,m++)
{
for(int j=1;j<=l;j++)
cout<<" ";
for(int k=1;k<=i;k++)
cout<<m;
cout<<endl;
}
getch();
}

Program to display Pyramid in C++

How to Program to display Pyramid in C++ Programming ?


Program to display the following pattern: Pyramid and Pattern pyramid pattern program in c pyramid pattern programs in java pyramid pattern program in php pyramid pattern of numbers in java pyramid pattern in javascript pyramid pattern in python pyramid pattern in c language

Program to display Pyramid in C++

Solution:
/*
Program to display the following pattern:
    1
   212
  32123
 4321234
543212345
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1;i<=5;i++)
{
for(int j=4;j>=i;j--)
cout<<" ";
for(int k=i;k>=1;k--)
cout<<k;
for(int l=2;l<=i;l++)
cout<<l;
cout<<endl;
}
getch();
}

This Program to display Pyramid in C++.