Monday, December 26, 2011
8:28 PM

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

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




#include
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"); } }

0 comments:

Post a Comment