Computer Science, asked by surajgorai7, 1 year ago

solve this Java program
1
3 5
7 9 11
13 15 17 19
21 23 25 27 29

Answers

Answered by Lazarus
1
class pattern
{
public static void main (int n)
{
int num=2,c,d;
for(c =1;c less than equal to n;c++)
{
for(d=1;d less than equal to c;d++)
{
System.out.print(num+" ");
num++;
}
System.out.println();
}
}
}
Answered by kshbhawan
0

Answer:

public class patern

{

public static void main (String args[])

{

int n=4,i,j,p=1;

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

{

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

{

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

p+=2;

}

System.out.println();

}

}

}

Explanation:

i'm only right

check in vs code.

Similar questions