Ad Code

NEW POST

6/recent/ticker-posts

HOW TO PRINT ALPHABET 'W' FROM STARS * PATTERS?? VERY SIMPLE LOGIC

OUTPUT:


CONCEPT:

For printing W we can use a very simple trick. simply print V and reverse it (means loop) so W will be formed, please refer to the V c code in my blog for better understanding.


for W c code refer below code u can edit according to your self


C CODE(RUNS ON TURBO C++):

 #include<stdio.h>

#include<conio.h>

void main()

{

int i,j;

clrscr();

for(i=1;i<=10;i++)

{

for(j=3;j<=10;j++)

{

if(i==j||j==10)

{

printf("*");

}

else

{

printf(" ");

}

}

printf("\n");

for(j=10;j>=3;j--)

{

if(i==j||j==10)

{

printf("*");

}

else

{

printf(" ");

}

}

}

getch();

}

Post a Comment

0 Comments