C PROGRAM TO CREATE X PATTERN
main()
{
int len,i,j,row;
printf("\n ENTER THE NUMBER OF THE ROWS : ");
scanf("%d",&row);
for(i=1;i<=row;i++) // for loop for the rows ..
{
for(j=0;j<row;j++) //for loop for the columns...
{
if(i==j||i+j==row -1) // this is the main logic for the required pattern..
{
printf("*");
}
else{
printf(" "); // white space where it should be blank..
}
}
printf("\n");
}
}
video link : https://youtu.be/aiPiPA1QEwI
Comments
Post a Comment