Computer Science, asked by abigail123, 1 year ago

plzz solve this java pattern​

Attachments:

amannishad0512p5zxh6: It is difficult to solve
amannishad0512p5zxh6: But i will answer in short period of time

Answers

Answered by amannishad0512p5zxh6
1

class Pattern

 {

      public static void main()

         {

            int i,j,k=5;

            for(i=1;i<=5;i++)

             {

                for(j=i+4;j<5+k;j++)

                 {

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

                   }

                  k++;

                System.out.println();

               }

           }

       }

I tried a lot of  logic ,then i am succeed@

Mark me brainlest @

Hope it will help you !!

                   


amannishad0512p5zxh6: Check it on bluej
amannishad0512p5zxh6: It's working or not
amannishad0512p5zxh6: Mark me brainlest @
amannishad0512p5zxh6: I worked hard to aanswer thsi
Answered by anindyaadhikari13
1

Question:-

Write a Java program to display the pattern.

5 6 7 8 9

6 7 8 9 10

7 8 9 10 11

8 9 10 11 12

9 10 11 12 13

Program:-

import java.util.*;

class Pattern

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the number of rows: ");

int n=sc.nextInt();

for(int i=1;i<=n;i++)

{

int a=i+4;

for(int j=1;j<=n;j++)

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

System.out.println();

}

}

}

Similar questions