A B-tree is a structure, basically, a node that contain a value and 2 pointers to 2 child nodes. The trick is that each child tree is a B-tree itself.
in this B-tree
1
2
3
4
5
6
7
1
2
3
is a B-tree by itself with just an indentation.
A B-tree can have an unlimited depth, so the most obvious solution is to use recursion.
you just have to keep track of indentation level.