Saturday, August 18, 2018

NUMBER PATTERN

  • Problem Description

    Consider group of boys are standing in a ground. They should be stand like n*n matrix after giving the value of n.The condition is same color dress weared boys should be in same column.The boys can sit in each row who should be in diagonal.The diagonal can start from end of the first row
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int i,j,n;
      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
        for(j=n;j>=1;j--)
        {
          if(i==j)
            printf("*");
          else
            printf("%d",j);
        }
        printf("\n");
      }
      return 0;
    }
        
        
        

      
      
      
     
  • Test Case 1

    Input (stdin)
    4
    
    
    Expected Output
    432*
    
    43*1
    
    4*21
    
    *321
  • Test Case 2

    Input (stdin)
    6
    
    
    Expected Output
    65432*
    
    6543*1
    
    654*21
    
    65*321
    
    6*4321
    
    *54321

No comments:

Post a Comment