#include <stdio.h>
#include <conio.h>
int main()
{
int r, c, row, col;
printf("Enter number of rows: ");
scanf("%d", &row);
printf("Enter number of columns: ");
scanf("%d", &col);
printf("\n\n");
for(r = 0; r < row; r++)
{
for(c = 0; c < col; c++)
{
printf("*");
}
printf("\n");
}
getch();
return 0;
}
#include <conio.h>
int main()
{
int r, c, row, col;
printf("Enter number of rows: ");
scanf("%d", &row);
printf("Enter number of columns: ");
scanf("%d", &col);
printf("\n\n");
for(r = 0; r < row; r++)
{
for(c = 0; c < col; c++)
{
printf("*");
}
printf("\n");
}
getch();
return 0;
}
Here's the output of the program:
Emtpy Box:
#include <stdio.h>
#include <conio.h>
int main()
{
int r, c, row, col;
printf("Enter number of rows: ");
scanf("%d", &row);
printf("Enter number of columns: ");
scanf("%d", &col);
printf("\n\n");
for(r = 0; r < row; r++)
{
for(c = 0; c < col; c++)
{
if(r > 0 && r < row - 1)
{
if(c > 0 && c < col - 1)
{
printf(" ");
}
else
{
printf("*");
}
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
return 0;
}
#include <conio.h>
int main()
{
int r, c, row, col;
printf("Enter number of rows: ");
scanf("%d", &row);
printf("Enter number of columns: ");
scanf("%d", &col);
printf("\n\n");
for(r = 0; r < row; r++)
{
for(c = 0; c < col; c++)
{
if(r > 0 && r < row - 1)
{
if(c > 0 && c < col - 1)
{
printf(" ");
}
else
{
printf("*");
}
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
return 0;
}
Here's the output of the program:
0 comments:
Post a Comment