Tuesday, 31 December 2013

PROGRAM TO PRINT HOLLOW SQUARE...!!!!

#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;
}

EXPECTED OUTPUT:




No comments:

Post a Comment