Saturday, May 22, 2010

Can any body give c++ code for the following pattern?

- - - - - *


- - - - * - *


- - - * - - - *


- - * - - - - - *


- * - - - - - - - *


* * * * * * * * * * *

Can any body give c++ code for the following pattern?
for (int i=5; i%26gt;=0; --i)


{


for (int j=0; j%26lt;i; ++j) printf("-");


if (i!=5)


{


printf("*");


for (int j=0; j%26lt;(5-i)*2-1; ++j)


printf("%c",(i==0)?'*':'-');


}


printf("*\n");


}


No comments:

Post a Comment