[ create a new paste ] login | about

Link: http://codepad.org/ppqwgrP4    [ raw code | output | fork ]

C, pasted on Jan 17:
#include<stdio.h>

int main (void) {
	int i,j ;
	char C[2] = {'*' , '.'} ;

	for (i=1; i<8; i++) {
		if (i%2 == 0){
			for (j=0; j<i; j++) {
				printf("%c" , C[0]) ;
			}
			for (; j<i*2; j++) {
				printf("%c",C[1]) ;
			}
		} else {
			for (j=0; j<i; j++) {
				printf("%c" , C[1]) ;
			}
			for (; j<i*2; j++) {
				printf("%c" , C[0]) ;
			}
		}
		printf("\n");
	}
	return 0 ;
}
/*
(1) j<i
(2) j<i*2
(3) %c
(4) C[0]
(5) C[1]
*/


Output:
1
2
3
4
5
6
7
.*
**..
...***
****....
.....*****
******......
.......*******


Create a new paste based on this one


Comments: