Write a program to accept the number of rows and print a square.
/* Write a program to accept the number of rows and print the following output
* * * *
* * * *
* * * *
* * * *
using independent
nested loop.*/
#include
<stdio.h>
void main()
{
int rows, i,j;
printf("Enter the number of rows :
");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=rows;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
Comments
Post a Comment