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

NINE Triangle Programs in C Language - SharadKgupta

It is a book that gives you a solid idea to make programs based on making triangle pattern in c language.This helps students and programmers as well as developers to grasp the subject.All programs are tested and executed by me .

Uploaded by

sharadkumargupta
Copyright
© Attribution Non-Commercial (BY-NC)
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)
386 views

NINE Triangle Programs in C Language - SharadKgupta

It is a book that gives you a solid idea to make programs based on making triangle pattern in c language.This helps students and programmers as well as developers to grasp the subject.All programs are tested and executed by me .

Uploaded by

sharadkumargupta
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 12

[Pick the date]

S
[Type BY: the document subtitle] | User A BOOK - SharadKGupta

This is a comprehensive book for the c learners .The most important programs in any language is to make triangles .Thus by seeing the importance of such programs I decided to put my efforts for students and developers. They will be able to shoot out their problems and will make a solid grasp on these programs. This book is presented with illustration that contains code as well as output. All programs are tested with output so you will not have any difficulty in learning them. You can email me on [email protected] any time.

Regards: SharadKGupta (Sharad Kumar Gupta, Moradabad, India)


1. Write a program to print the following triangle pattern in C language.

* * ***

NINE Triangle Programs In C- SharadKGupta

Page 2

**** *****
C SOURCE CODE

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

2. Write a program to print the following triangle pattern in C language.

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

NINE Triangle Programs In C- SharadKGupta

Page 3

** *
C SOURCE CODE

#include<stdio.h> void main () { int i, j; for (i=1; i<=5; i++) { for (j=5; j>=i; j--) { printf ("*"); } printf ("\n"); } }
3. Write a program to print the following triangle pattern in C language.

* ** ***

NINE Triangle Programs In C- SharadKGupta

Page 4

**** *****
C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 5

4. Write a program to print the following triangle pattern in C language.

1 22 333 4444 55555

C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 6

5. Write a program to print the following triangle pattern in C language.

55555 4444 333 22 1


C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 7

6. Write a program to print the following triangle pattern in C language.

1 12 123 1234 12345


C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 8

7. Write a program to print the following triangle pattern in C language. 54321 4321 321 21 1
C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 9

8 . Write a program to print the following triangle pattern in C language. 1 12 123 1234 12345

C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 10

9. Write a program to print the following triangle pattern in C language. 1 22 333 4444 55555
C SOURCE CODE

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

NINE Triangle Programs In C- SharadKGupta

Page 11

THANK YOU FOR READING


NINE TRIANGLE PROGRAMS IN C
SharadKGupta ( Sharad Kumar Gupta ,Moradabad , India ) Email : [email protected] Send Your Reviews to me by following subject : NINE TRIANGLE PROGRAMS IN C For Improving It.

NINE Triangle Programs In C- SharadKGupta

Page 12

You might also like