Wednesday, June 29, 2022

Sara and pattern (Functional Problem)

 Sara and pattern (Functional Problem)

Easy

Time Limit: 2 sec
Memory Limit: 128000 kB
Problem Statement
Sara loves patterns, today she encounters an interesting pattern and wants to write a code that can print the pattern of a given height N. As Sara is weak in programming help her to code it.

static void Pattern(int N){
//Enter your code here
for(int row=0;row<N;row++){

      int num = row*6;

      for(int col=0;col<N;col++){

          System.out.print(num+" ");

          num+=4;

        }

        System.out.println();

    }

}

No comments:

Post a Comment

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...