#include<stdio.h>
#include<conio.h>
int main()
{
int size;
printf("please enter the size of square:");
scanf("%d",&size);
for (int row = 1; row <= size; row++)
{
for (int col = 1; col <= size; col++)
{
if (row > 1 && row < size && col > 1 && col < size)
{
printf(" ");
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
return 0;
}
#include<conio.h>
int main()
{
int size;
printf("please enter the size of square:");
scanf("%d",&size);
for (int row = 1; row <= size; row++)
{
for (int col = 1; col <= size; col++)
{
if (row > 1 && row < size && col > 1 && col < size)
{
printf(" ");
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
return 0;
}
No comments:
Post a Comment