how to print pattern in c
Answers
Answered by
0
#include <>
main ()
{
int i,j, N = 13;
for (j=0;j<N;j++) printf(". ");
printf("\n");
for (i=1; i< N-1 ; i++) {
if (i == (N-1)/2 ) {
printf(". "); for (j=1; j<N; j++) printf("\* "); printf("\n");
}
else {
printf(". "):
for (j=1;j<N-1;j++)
if ((i==j)|| (i+j== N-1) || (j==N/2)) printf("\* ");
else printf(" ");
printf(". \n");
}
}
for (j=0; j<N;j++) printf(". ");
printf("\n");
}
main ()
{
int i,j, N = 13;
for (j=0;j<N;j++) printf(". ");
printf("\n");
for (i=1; i< N-1 ; i++) {
if (i == (N-1)/2 ) {
printf(". "); for (j=1; j<N; j++) printf("\* "); printf("\n");
}
else {
printf(". "):
for (j=1;j<N-1;j++)
if ((i==j)|| (i+j== N-1) || (j==N/2)) printf("\* ");
else printf(" ");
printf(". \n");
}
}
for (j=0; j<N;j++) printf(". ");
printf("\n");
}
Similar questions
Social Sciences,
8 months ago
English,
8 months ago
English,
8 months ago
Business Studies,
1 year ago
Biology,
1 year ago
English,
1 year ago
English,
1 year ago