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.

Saturday 22 June 2013

Program to print the Star pattern 1 (Right-angled Triangle)

#include<stdio.h>
main()
{
char prnt = '*';
int i, j, nos = 4, s;

clrscr();
for (i = 1; i <= 5; i++)
{
for (s = nos; s >= 1; s--)
{
printf("  ");
}
for (j = 1; j <= i; j++)
{
printf("%2c", prnt);
}
printf("\n");
  --nos;  

}
getch();
}



No comments:

Post a Comment