0% found this document useful (0 votes)
33 views7 pages

Patternn C P

Some pattern problems are there

Uploaded by

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

Patternn C P

Some pattern problems are there

Uploaded by

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

*

**
***
****
*****
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<d=5;i++)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
*
**
***
****
*****
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,c=1;
clrscr();
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf(" ");
}
for(k=1;k<=c;k++)
{
printf("* ");
}
c++;
printf("\n");
}
getch();
}
*****
****
***
**
*
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
*****
****
***
**
*
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,c=5;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf(" ");
}
for(k=1;k<=c;k++)
{
printf("* ");
}
c--;
printf("\n");
}
getch();
}
*
***
*****
*******
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,c=1,d=0;;
clrscr();
for(i=4;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf(" ");
}
for(k=1;k<=c;k++)
{
printf("* ");
}
for(k=1;k<=d;k++)
{
printf("* ");
}
c++;
d++;
printf("\n");
}
getch();
}
*
***
*****
***
*
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i==1||j==1||i==5||j==5)
{
if(i==3||j==3)
{
printf("* ");
}
else
{
printf(" ");
}
}
else
{
printf("* ");
}
}
printf("\n");
}
getch();
}
*
**
***
**
*
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=3;i++)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
for(i=2;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
*
**
***
**
*
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c=1,d=2;
clrscr();
for(i=3;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf(" ");
}
for(j=1;j<=c;j++)
{
printf("* ");
}
c++;
printf("\n");
}
for(i=2;i>=1;i--)
{
for(j=1;j<=d;j++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("* ");
}
d++;
printf("\n");
}
getch();
}
*****
*****
*****
*****
*****
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
*****
* *
* *
* *
*****
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i==1||i==5||j==1||j==5)
printf("* ");
else
printf(" ");

}
printf("\n");
}
getch();
}

You might also like