Advertisement
Realratnadwip

Star Rectangle with minimum Variables

Jun 4th, 2025
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | Source Code | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main()
  5. {
  6.     int row, col, c;
  7.  
  8.     printf("This is a simple program to print a rectangle star pattern using while loop.\n\n");
  9.     printf("Enter number of rows : ");
  10.     scanf("%d", &row);
  11.     printf("Enter number of columns : ");
  12.     scanf("%d", &col);
  13.  
  14.     c = col;
  15.    
  16.     while(row > 0)
  17.     {
  18.         col = c;
  19.         while(col > 0)
  20.         {
  21.             printf("*");
  22.             col--;
  23.         }
  24.         printf("\n");
  25.         row--;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement