As I know, to print such table in the screen, you need nested do-while loops,such as
do{
do{
}while();
}while();