patternprogram_342 softethics

Pattern 342

C

#include <stdio.h>

int main()
{
  int i,j;
  int n=7;//size

  for(i=0; i<n; i++)
  {
    for(j=0; j<n; j++)
    {
      if(    i==0 || j==0 || i==j || i==n-1 || j==n-1 ||  i+j == n-
             1)
      {
        printf("* ");
      }
      else
      {
        printf("  ");
      }
    }
    printf("\n");
  }
}

C++

Java

C#

Python

5 1 vote
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments