plzz solve this java pattern
Attachments:
amannishad0512p5zxh6:
It is difficult to solve
Answers
Answered by
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 !!
Answered by
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