Ad Code

NEW POST

6/recent/ticker-posts

HOW TO PRINT ALPHABET "J" FROM STARS ? VERY SIMPLE LOGIC!



OUTPUT:

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

              *                                                                        

              *                                                                        

              *                                                                        

              *                                                                        

              *                                                                        

              *                                                                        

              *                                                                        

******** 


CONCEPT OF THIS CODE:

First, we have to print the line that is the J top line. and then print the vertical line of J and the horizontal line of J.

first, take for loop for column and then for columns and then define or put the condition for a print straight line of * and close that loop and then open for the second loop for vertical line DONT CLOSE THE FIRST LOOP (LOOP FOR ROWS)  and put the conditions for vertical line and close this loop. now we have to print the horizontal line. 


CODE:(RUNS ON TURBO C++)

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j;

clrscr();

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

{

printf("*");

}

printf("\n");

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

{

for(j=1;j<=8;j++)

{

if(j==8||i==8)

{

printf("*");

}

else

{

printf(" ");

}

}

printf("\n");

}


getch();

}


Post a Comment

0 Comments