diff --git a/patterns/print_rectangle.c b/patterns/print_rectangle.c new file mode 100644 index 0000000..a889934 --- /dev/null +++ b/patterns/print_rectangle.c @@ -0,0 +1,36 @@ +/* +enter the height5 +***** +* * +* * +* * +***** + +*/ +#include +void main() +{ + int n,i,j; + printf("enter the height of rectangle"); + scanf("%d",&n); + for(i=1;i<=n;i++) + { + for(j=1;j<=n;j++) + { + if(i==1||i==n) + { + printf("*"); + } + else if(j==1||j==n) + { + printf("*"); + } + else + { + printf(" "); + } + + } + printf("\n"); + } +}