0% found this document useful (0 votes)
40 views

Practical Set-4 4.1 (1) .Write A Program To Print This Pattern.

The document contains C programs to print various patterns. Each program takes a number n as input and prints patterns of numbers, characters or symbols in increasing or decreasing order. The patterns include triangles, pyramids, numbers, letters and other shapes. The programs use for loops and print statements to output the patterns row-by-row.
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)
40 views

Practical Set-4 4.1 (1) .Write A Program To Print This Pattern.

The document contains C programs to print various patterns. Each program takes a number n as input and prints patterns of numbers, characters or symbols in increasing or decreasing order. The patterns include triangles, pyramids, numbers, letters and other shapes. The programs use for loops and print statements to output the patterns row-by-row.
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/ 10

PRACTICAL SET-4

4.1(1).Write a program to print this pattern.

**

***

****

*****
PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{for(j=1;j<=i;j++)

printf("* "); }

printf("\n"); }

getch();}
4.1(2).Write a program to print following pattern.

**

***

****

*****
PROGRAM:

#include<stdio.h>

#include<conio.h>

int main()

{int i,j,k,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{for(k=1;k<=n-i;k++)

{printf(" ");}

for(j=1;j<=(2*i)-1;j++)

{printf("*");}

printf("\n");}

getch();}
4.1(3).Write a program to print this pattern.

*****
****

***

**

PROGRAM;

#include<stdio.h>

#include<conio.h>

int main()

int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=n;i>=1;i--)

for(j=1;j<=i;j++)

{printf("*");}

printf("\n");}

getch();}
4.2(1).Write a program to print this pattern.

12

123

1234

12345
PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

{int i,j,n;

clrscr();

printf("Enter the number:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{for(j=1;j<=i;j++)

{printf("%d",j); }

printf("\n"); }

getch();}
4.2(2).Write a program to print this pattern.

12345

1234

123

12

1
PROGRAM:

#include<stdio.h>

#include<conio.h>

int main()

{int i,j;

clrscr();

printf("Enter n:");

scanf("%d");

for(i=0;i<=5;i++)

{for(j=0;j<5-i;j++)

{printf("%d",j+1);}

printf("\n");}

getch();}
4.2(3).Write a program to print this pattern.

55555

4444

333

22

1
PROGRAM:

#include<stdio.h>

#include<conio.h>

int main()

{int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=n;i>=1;i--)

{for(j=1;j<=i;j++)

{printf("%d",i);}

printf("\n");}

getch();}
4.2(4).Write a program to print this pattern.

22

333

4444

55555
PROGRAM:

#include<stdio.h>

#include<conio.h>

int main()

int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=1;i<6;i++)

for(j=0;j<i;j++)

{printf("%d",i);}
printf("\n");}

getch();}

4.3(1).Write a program to print this pattern.

AAAAA

BBBB

CCC

DD

E
PROGRAM:

£include<stdio.h>

#include<conio.h>

void main()

int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=1;i<=n;i++)

for(j=i;j<=n;j++)

{printf("%c",(char)(i+64));}
printf("\n");}

getch();}

4.3(2).Write a program to print this pattern.

ABCDE

ABCD

ABC

AB

A
PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

int i,j,n;

clrscr();

printf("Enter n:");

scanf("%d",&n);

for(i=1;i<=n;i++)

for(j=1;j<=n-i+1;j++)

{printf("%c",(char)(j+64));}
printf("\n");}

getch();}

You might also like