If call a program it should show the output as given


If I Call method: printGrid(rows, colms);

Output should like:

printGrid(3,6);

1, 4, 7, 10, 13, 16
2, 5, 8, 11, 14, 17
3, 6, 9, 12, 15, 18

printGrid(5, 3);

1, 6, 11
2, 7, 12
3, 8, 13
4, 9, 14
5, 10, 15
===========================================
This is my code.
============================================
public class Grid{
public static void main(String[] args){

PrintGrid(3,6);
}
public static void PrintGrid(int rows , int cols){
for(int line=1; line<=rows; line++){
for(int i=line; iSystem.out.print(i);
}
System.out.println();

}
}
}"

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: If call a program it should show the output as given
Reference No:- TGS0135613

Expected delivery within 24 Hours