Social Icons

Friday, 21 March 2014

C program to print this triangle

#include <stdio.h>
#include<conio.h>
int main()
{
int n,i,j;
clrscr();
printf("\n Enter Number of rows :  ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\n\t\t");        /* it takes space from left side of screen */
for(j=1;j<=i;j++)
printf(" *");
}
getch();
}

also see codes of following-
Floyd triangle
Pascal triangle

                                                             OUTPUT

No comments:

Post a Comment