[AccessD] OT: LINQPad for seasoned devs musing and for teaching kids programming basics using 5-th grade math tasks...

Salakhetdinov Shamil mcp2004 at mail.ru
Sun Sep 30 09:38:12 CDT 2012


Hi All --
It's quiet here this Sunday and I just wanted to share with you how one can use LINQPad (http://www.linqpad.net/) to keep oneself training in programming (code snippets) using C#, VB.NET, SQL, F#, LINQ... and also to get your kids math training more entertaining/interesting (I hope)...

Context: My kid gets a set of 7 math tasks quiz every week and I'm involved in the "support & test" process. I wanted to use that opportunity to give my kid some programming and algorithmic thinking lessons using one of the modern programming languages as e.g. JavaScript or C# (or even(!) VB.NET).
And I wondered how could one use the following 5-th grade math tasks to gradually teach a kid programming basics (and refresh/keep-fresh oneself brain-cells), and teach not only basics but also foundations of "algorithmic thinking" such as "brute-force" linear search approach vs. heuristics to reduce search space, as well as (.NET style) functional programming/LINQ and side-effects of converting of C# code to VB.NET and vice versa? (Well, training in LINQ and fixing side-effects of code conversion are for myself not for my kid.)
Here is the current set of seven tasks. (The actual tasks parameters are changed):
// 7. At a meeting seven people shook hands. How many hand-shaking were there?
// 6. To ascend from the fifth to the sixth floor, we must take up to 26 steps. 
// How many steps you have to pass in order to ascend from the second to the eight floor?
// 5. There are pegs hammered a quarter of a meter away from each other
// at all the corners and the sides of a triangle. 
// How many pegs are hammered if a side of the triangle is 15 meters long?
// 4. How many odd numbers are from 203 to 343 inclusive?
// 3. How many three-digit numbers contain a digit 7?
// 2. There are 390 pages in a book. How many digits are needed to number all the pages?
// 1. How many digits would you have to write if you write
// all the natural numbers from 7 to 107 inclusive?
FYI: I've currently chosen C# to prepare and to run math tasks solutions code snippets using LINQPad. And http://www.developerfusion.com/tools/convert/csharp-to-vb/ to convert C# code snippets to VB.NET.
I have the solutions of all the above tasks using C#. 
They are mainly "one-liners" as you might expect.

Would you like to see the solutions posted here as the code snippets you can run in LINQPad?
Would you like first to post here your solutions for the above tasks in VBA?

Could you also please check and fix if needed my English translations of the tasks definitions which were originally written in Russian?

Thank you.
-- Shamil


More information about the AccessD mailing list