Friday, July 22, 2011

Program to print stars in Traingular pattern {Type 2}


*
*  *
*  *  *
*  *  *  *
*  *  *  *  *
-----------------------------------------------------------------------
/*Serial No.23     [swami144.cpp]*/

/* this program prints traingle as big as u want.*/
#include<stdio.h>
#include<conio.h>
int i,j,n;
void main()
{
clrscr();
printf("Enter the no. of lines of traingle:");
scanf("%d",&n);
printf("\n");
for(i=1;i<=n;i++)
{printf("*\n");
if(j==n)
break;
for(j=1;j<=i;j++)
printf("*");
}
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...