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
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
Similar questions
Math,
7 months ago
World Languages,
7 months ago
Physics,
7 months ago
Computer Science,
1 year ago
Math,
1 year ago
Math,
1 year ago