Computer Science, asked by rupbhusare3283, 1 year ago

Write a program to print the pattern in java 1 2 6 3 7 10 4 8 11 13 5 9 12 14 15

Answers

Answered by aqibkincsem
5

"The code of the pattern will be:

public class floyd_of_triangle

{

public static void main(String[] args) {

for(int x=1;x<=5;x++) {

int a=0,b=4;

for(int y=1;y<=x; y++){

int s=x+a;

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

a=a+b; b--; }

System .out .println (); } } }

Output:

1

2 6

3 7 10

4 8 11 13

5 9 12 14 15

"


nitish8089: first answer error
nitish8089: good luck...
nitish8089: s+""""
Similar questions