One of the hardest thing about learning how to program (or teaching someone how to program) is having simple, clear projects that can be completed and are a bit more fun than "print Hello world 10 times using a loop" or "Display all of the employees in the Northwinds database", and are also sufficiently complex to actually use the features of a programming language (event driven vs. procedural, etc).
So... how about some projects/ideas for someone to work on to help them learn to code. Ideally should be very cross platform as well.
One of my favorite, and I've used it for learning TRS-80 BASIC, Turbo Pascal, Visual Basic, and Java, and for teaching VB and PHP is "Create a deck of cards, shuffle them, deal a hand for poker (5 or 7 card stud) and determine what hand was drawn. Extend to drawing 2 hands and determining which hand would win." And of course it can be further extended to allow asking for more cards (5 card draw) or changing it to Texas Hold 'Em or whatever.
What I did was recreate some simple games like Pong, Pocket Tanks and some web game.
There's also ProjectEuler.net (https://projecteuler.net/archives), you solve mathematical problems, often these questions end up teaching you things about algorithms, optimization and problem solving skills. It even has a problem very similar to what you said https://projecteuler.net/problem=54
A dungeon crawl game might be fun. Where they have to print out a map and the user navigates to the end. It also could be enhanced by adding enemies, traps, chests, other areas, etc.
Then it also depends on interests. Interest in game development? Make the list below. Like GUIs? Learn to make your own GUI library. Interested in music/sound? Make sound manipulation programs or sound libraries to load, play, and manipulate sound playback.
Number Guessing
Tic Tac Toe
Hangman
Pong
Worm
Breakout
Missile Command
Space Invaders
Asteroids
Tetris
Pac-Man
Ikari Warriors
Super Mario Bros
Legend of Zelda