给定正整数n,打印输出边长为n的平行四边形

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

要求输出图形为请添加图片描述

int main()
{
//整体思路:将平行四边形分为上下两部分,n行就是【1~2*n-1】,上下两部分单独进行循环。
 int i,star1,star2,space1,space2,n;
 printf("请输入行数:\n");
 scanf("%d",&n);

 for(i=1;i<=2*n-1;i++)
 {
	 // 上半部分的循环:
  star1 = i;
  while(star1 && star1<=n)
  {
   printf(" * ");
   star1--;
  }
  space1 = n-i;
  while(space1 && space1>0)
  {
   printf("   ");
   space1--;
  }
  下半部分的循环。
  if(i<=n)
  printf("\n");
  if(i>n)
  {
   space2 = i-n;
   star2 = n-space2;
   while(space2)
   {
    printf("   ");
    space2--;
   }
   while(star2)
   {
    printf(" * ");
    star2--;
    
   }
   printf("\n");
  }
 }

 return 0;
}

最后的运行结果是
请添加图片描述