Category Archives: Print Figures

Program for Pascal Triangle in C and C++

Here I have shared simple program for pascal triangle in C and C++. Basically Pascal’s triangle is a triangular array of binomial coefficients. An example for how pascal triangle is generated is illustrated in below image. If you have any doubts then you can ask it in comment section. Each number is the sum of… Read More »

C/C++ Program to Print Following Pattern

Here I am sharing the C and C++ program to print the pattern shown in below image. This pattern is printed using stars (*). It has two parts, the lower half is just opposite of upper half. Comment below if you are facing any problem in understanding the code. C Program C++ Program

C Program to Print India Map

In this article I am sharing the program to print India map. If you like it, please do share it! Also Read: Valentine’s Day Special: C++ Program to Print Heart Shape with Happy Valentine’s Day Message inside it #include <stdio.h> main() {     int a,b,c;     int count = 1;     for (b=c=10;a=”-… Read More »

C program to print following triangle:

#include<stdio.h> #include<conio.h> void main() { int i,j,k,n,a,b; clrscr(); printf(“How many lines?”); scanf(“%d”,&n); n=n*2; for(i=1;i<n;i+=2) { for(j=n-1;j>i;j-=2) printf(” “); for(k=1;k<=(i/2)+1;++k) printf(“%d”,k); for(k=i/2;k>=1;–k) printf(“%d”,k); printf(“n”); } getch(); }

C++ program to print the following pattern:

#include<iostream.h>#include<conio.h>void main(){ clrscr(); //to clear the screen int i,j,k,n; cout<<“How many lines?”; cin>>n; n*=2; for(i=0;i<n;i+=2) { cout<<“n”; for(j=n;j>i;j-=2) cout<<” “; for(k=0;k<=i;++k) cout<<“*”; } getch(); //to stop the screen}

C++ program to print the following design:

#include<iostream.h>#include<conio.h>void main(){ clrscr(); //to clear the screen int i,j,k,n;  cout<<“How many lines?”; cin>>n;  n*=2; for(i=0;i<n;i+=2) { cout<<“n”; for(j=1;j<i;j+=2) cout<<” “; for(k=n-1;k>i;–k) cout<<“*”; } getch(); //to stop the screen}