Hollow Square Pattern

Program that displays hollow square pattern.

Sample Input
5
Sample Output
*****
*   *
*   *
*   *
*****
Solution in C JAVA PYTHON
#include<stdio.h>
int main() {
  int n, row, col;
  scanf("%d",&n);
  for(row=1;row<=n;row++){
    for(col=1;col<=n;col++){
      if(row==1 || row==n || col==1 || col==n)
        printf("*");
      else
        printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Input
5
Output
*****
*   *
*   *
*   *
*****