Program for pattern?
#
* #
#*#
*#*#
#*#*#
Answers
Answered by
0
Answer:
#*#*# ,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Answered by
1
Answer:
ans is given below
Explanation:
#include<stdio.h>
void main()
{
int row=0,col=0,rnum=0;
printf("enter number of rows:");
printf("\n");
scanf("%d",&rnum);
for(row=1;row<=rnum;row++)
{
for(col=1;col<=row;col++)
{
if(row%2!=0) //part for odd no. of rows
{
if(col%2!=0) //print for odd no. of col
{
printf("#");
}
else //print for even no. of col
{
printf("*");
}
}
else //part for even no. of rows
{
if(col%2!=0) //print for odd no. of col
{
printf("*");
}
else //print for even no. of col
{
printf("#");
}
}
}
printf("\n");
}
}
Attachments:
Similar questions