Thursday 29 September 2016

pattern


            1
           1 2
         1 2 3
       1 2 3 4
     1 2 3 4 5
      1 2 3 4
        1 2 3
          1 2
            1


#include<stdio.h>
#include<conio.h>
void maint()
{
int i,j,k;
int p_height=5;
clrscr();
for(i=1;i<=p_height;i++)
{
for(k=p_height-1;k>=i;k--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d",j);
}
for(i=p_height-1;i>=1;i--)
{
for(k=p_heigh-1;k>=i;k--)
{
printf("%d",j);
}
printf("\n");
getch();
}

pattern

 

pattern

 5          1
    4     2
       3
  4       2
5             1


#include<stdio.h>#include<conio.h>void main(){int n=5;int i,j;clrscr();for(i=n;i>=1;i--){for(j=n;j>=1;j--){if(i==j||i+j==n+1)printf(“%d”,j);elseprintf(“ “);}getch();} 

Tuesday 27 September 2016

patterb 16

5             5
 4           4
   3       3
     2   2
       1

#include<stdio.h>
#include<conio.h>
void main()
{
int n-5;
int i,jl
for(i=n;i>=1;i--)
{
for(j=n-1;j>=i;j--)
{
printf("%d",i);
for(j=1;j<(i-1)*2;j++)
{
printf(" ");
}
if(i>1)
{
printf("%d",i)
}
printf("\n");
}
getch();
}

pattern 13

      A
     B B
   C C C
 D D D D
E E E E E
 D D D D
   C C C
     B B
       A


#include<stdio.h>
#include<conio.h>
void main()
{

int i,j,k;
int pheight=5;
clrscr();
for(i=0;i<pheight;i++)
{
for(k=pheight-1;k>1;k--)
{
printf(" ");
}
for(j=0;j<=1;j++)
{
printf("%c",i+65); //65-?ascii value of A
}
printf("\n");
}
for(i=pheight-1;k>1;k--)
{
printf(" ");
}
for(j=i;j>=0;j--)
{
printf("%c",i+65);
}
printf("\n");
}
getch();
}

pattern 9

*
* *
* * *
* * * *
* * *
* *
*

#include<stdio.h>
#include<conio.h>
void main()
{
int size=3;
int i.j;
clrscr();
for(int=size;i>=size;i--)
{
for(j=size;j>=abs(i);j--)
{
printf("*");
}
printf("\n");
}
getch();
}

pattern 12

                *
              * *
             * * *
            * * * *
          * * * * *
         * * * * * *
        * * * * * * *
         * * * * * *
           * * * * *
             * * * *
               * * *
                 * *
                   *


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
int Pheight=5;
clrscr();
for(i=1li<=pheight;i++)
{
for(k=pheight-1;k>=1;k--)
{
printf("*");
}
printf("\n");
}

//bottom pyramid
for(i=pheight-1;i>=1;i--)
{
for(k=pheight-1;k>=i;k--)
{
printf("*");
}
printf("\n");
}
getch();
}