Thursday, August 16, 2018

STAR FORMATION

Problem Description
·        Pyramid Star Formation


   CODING ARENA::



#include <stdio.h>
int main()
{
  int n,i,j;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
    for(j=0;j<i;j++)
      printf("*");
    printf("\n");
  }

      return 0;
}



·        Test Case 1

Input (stdin)
5

Expected Output
*

**

***

****

*****
·        Test Case 2

Input (stdin)
3

Expected Output
*

**

***


6 comments:

  1. FOR FURTHER CLASSIFICATIONS CONTACT US.

    ReplyDelete
  2. int i, j, rows;

    printf("Enter number of rows: ");
    scanf("%d",&rows);

    for(i=1; i<=rows; ++i)
    {
    for(j=1; j<=i; ++j)
    {
    printf("%d ",j);
    }
    printf("\n");
    }

    ReplyDelete
  3. Program for pyramid of number
    int i, j, rows;

    printf("Enter number of rows: ");
    scanf("%d",&rows);

    for(i=1; i<=rows; ++i)
    {
    for(j=1; j<=i; ++j)
    {
    printf("%d ",j);
    }
    printf("\n");
    }

    ReplyDelete