Thursday, September 13, 2018

PATTERN 5

  • Problem Description

    Write a program to generate a following @s triangle: 
    @
    @ @
    @ @ @
    @ @ @ @
    @ @ @ @ @
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int i,j,n;
      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
        for(j=1;j<=i;j++)
        {
          printf("@");
        }
        printf("\n");
      }
      return 0;
    }
  • Test Case 1

    Input (stdin)
    5
    
    
    Expected Output
    @
    
    @@
    
    @@@
    
    @@@@
    
    @@@@@
  • Test Case 2

    Input (stdin)
    9
    
    
    Expected Output
    @
    
    @@
    
    @@@
    
    @@@@
    
    @@@@@
    
    @@@@@@
    
    @@@@@@@
    
    @@@@@@@@
    
    @@@@@@@@@

No comments:

Post a Comment