OUTPUT:
FIRST, define two loops I for rows and j for columns now define I and then define J loop print horizontal lines in P. put in if condition for print respective patterns you can take help for below code to understand better
C CODE:(RUNS ON TURBO C++)
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
clrscr();
for(i=1;i<=10;i++)
{
for(j=1;j<=1;j++)
{
printf("*");
}
for(k=1;k<=6;k++)
{
if(i==1||i==7||i>=2&&i<=6&&k==6)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
getch();
}
0 Comments
if you have any doubt, plz let me know