26 December 2011

C Program to Print Triangle of "*" and "#"

Leave a Comment
 Program to Print Triangle of "*" and "#"
*
* #
* # *
* # * #
* # * # *




#include <stdio.h>

void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(i%2==0)
{
if(j%2==0)
printf("# ");
else
printf("* ");
}
else
{
if(j%2==0)
printf("# ");
else
printf("* ");
}
}
printf("\n");
}
}

If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

0 comments:

Post a Comment