UncleCoder.com

UncleCoder.com

Free programming examples and instructions

C program to generate Star sequence

C program for how to generate Star sequence

by Krishna


Posted on 27 Jun 2018 Category: C Views: 1706


C program to generate Star sequence

Below program shows how to generate  a simple star sequence using C . Here the user reads a limit to generate the sequence.

*

* *

* * *

……………

Lets see a simple C Program to generate the above star sequence.

#include<stdio.h>
#include<conio.h>
void main()
{
  int n,i,j;
  printf(“Enter the sequence limit :”);
  scanf(“%d”,&n);
  for(i=1;i<=n;i++)
  {
    for(j=i;j<=i;j++)
    {
      printf(“*\t”);
    }
    printf(“\n”);
  }
  getch();
}

OUTPUT



Leave a Comment:


Click here to register

Popular articles