draw a star pattern in c

 #include<stdio.h>

int main()

{

  int i,j,r,k=0;

  

  printf("Enter number of rows:");

  scanf("%d",&r);

  

  for(i=1;i<=r;++i,k=0)

  {

  for(j=1;j<=r-i;++j)

    {

  printf(" ");

    }

  while(k != 2*i-1)

  {

  printf("*");

  ++k;

  }

  printf("\n");

   } 

return 0;

}

Comments

Popular posts from this blog

create a num table in a new file in c

write a programme to compare time stamp in c

write a struct programme to keep bank details in c