OUTPUT:
CONCEPT:
For making M first define i and j loop rows and coloumns then first print horizontal line form 'M' and print diagonals elements(if(i==j))
and in next line reverse it M patter will be ready..
below code will help to understand
C CODE(RUNS ON TRUBO C++):
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=8;i++)
{
for(j=8;j>=1;j--)
{
if(j==1||i==j)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
for(j=1;j<=8;j++)
{
if(j==1||i==j)
{
printf("*");
}
else
{
printf(" ");
}
}
}
getch();
}
0 Comments
if you have any doubt, plz let me know