This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Friday 28 June 2013

Program to print the Star pattern 4 (Pyramid)

#include <stdio.h>
void main()
{
int row, c, n, temp;
clrscr();
printf("Enter the number of rows in Pyramid: ");
scanf("%d",&n);
temp = n;
for ( row = 1 ; row <= n ; row++ )
{
for ( c = 1 ; c < temp ; c++ )
printf(" ");
temp--;
for ( c = 1 ; c <= 2*row - 1 ; c++ )
printf("*");
printf("\n");
}
getch();
}


No comments:

Post a Comment