Saturday, August 18, 2018

PATTERN 6

  • Problem Description

    Write a program to generate a following numbers structure
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int num,r,c;
      scanf("%d",&num);
      for(r=1;num>=r;r++)
      {
        for(c=1;c<=num;c++)
          printf("%d",c);
        
        printf("\n");
      }
      return 0;
    }
  • Test Case 1

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

    Input (stdin)
    3
    
    
    Expected Output
    123
    
    123
    
    123

No comments:

Post a Comment