Saturday, October 16, 2010

Programming with C (looping with for)

N=5

*
***
*****
*******

this concept is (n*2)-1;

for(int a=1,c=1;a=N;a++){

for(int b=N;b>a;b--){

printf(" ");

}

for(d=0;d>c;d++){

printf("*");

}

c=((a+1)2)-1;//same like N*2-1

printf("\n");

}

No comments:

Post a Comment