c program to print Square pattern containing stars

c program to print Square pattern containing stars

  1. #include<stdio.h>
  2. int main()
  3. {
  4.  int i,j, n=5;
  5.  //Logic to print square based on given value of N... 
  6.  
  7.  for(i=0; i<n; i++)
  8.  {
  9.   for(j=0; j<n; j++)
  10.    printf("* "); //one space in printf prints proper output
  11.   printf("\n");
  12.  }
  13.  return 0;

Output


* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

choose next program from this list

Comments