C language to print a special pattern of the implementation code

  • 2020-04-01 23:26:41
  • OfStack

The code is as follows:


#include <stdio.h>
int main()
{
 //It's about finding relationships between rows and columns
   int i,j,k;   
   for(i=0;i<4;i++)  //As a row loop
   {
    for(j=0;j<=2-i;j++)  //Print white space in a line
     printf(" ");
    for(k=0;k<=2*i;k++)  //Print the * on a line
     printf("*");
    printf("n");
   }
   return 0;
}


Related articles: