Skip to Main Content
Tiny C Projects
book

Tiny C Projects

by Dan Gookin
December 2022
Beginner content levelBeginner
384 pages
10h 44m
English
Manning Publications
Content preview from Tiny C Projects

14 Lotto picks

Back when I was a C programmer hatchling, I returned from a trip to Las Vegas eager to write my own keno program. Keno is a random-number game, a cross between the lottery and bingo. You pick several numbers in the range from 1 through 80. Payouts depend on how many numbers you choose and guess correctly.

In the process of writing the code, it became apparent that the payouts offered in the casino were nowhere close to the true odds. For example, if you pick 10 numbers and guess correctly, you win $200,000. But the odds of picking 10 out of 10 numbers in a range of 80 numbers are 1:8,911,712. You should win $8,911,712, right? But at least they have killer shrimp cocktail for a dollar. Or they once did.

The process of programming ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Five Lines of Code

Five Lines of Code

Christian Clausen
Modern C

Modern C

Jens Gustedt
Effective C

Effective C

Robert C. Seacord
Extreme C

Extreme C

Kamran Amini

Publisher Resources

ISBN: 9781633439825Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link