Skip to main content

C Programming Puzzles & Exercises

Melanie has a BS in physical science and is in grad school for analytics and modeling. She also runs a YouTube channel: The Curious Coder.

Solving programming puzzles can really boost your skill set and keep you sharp.

Solving programming puzzles can really boost your skill set and keep you sharp.

Looking to hone your C programming skills? Are you just learning to program and need to find an area where you need to improve? Completing some C programming exercises is an awesome way to become a better programmer!

Doing some of these challenges can help you learn more about the C language, improve problem-solving skills, and master new coding techniques.

Finding programming exercises can be difficult, so I created this guide to C programming exercises. Here is a growing list of places where you can brush up on your programming skills (and to learn new ones.)

Wikibooks C Exercises

If you're new to programming in C, Wikibooks has a page full of quizzes on a wide number of features within the C programming language.

The site starts out by quizzing you on their material and then moves on to questions that require you to write a specific program. Each question contains a link to an answer so you can see whether or not you are correct.

You can visit their C Programming Beginning Exercises page to get started.

USA Computing Olympiad Programming Contest

The USA Computing Olympiad Programming Contest site not only hosts a programming contest but also offers a large amount of training. Whether or not you're interested in the contest, you can make use of their preparation material.

You will be required to register at the gateway before viewing the content. The site is language agnostic, so if the C programming language really isn't your thing (or you'd like to learn another language), you'll still be able to enjoy this resource.


Topcoder is one of the most popular sites offering programming challenges and exercises. While it's another competitive programming community, it's great for improving programming skills independently.

Project Euler

Project Euler is an incredibly popular site for those interested in programming puzzles.

This site allows users to submit answers to problems in a number of programming languages including C.

Word of warning: Project Euler is for those who really know math, so if math isn't your strong suit, you may want to look elsewhere.

A sample program in the C language

A sample program in the C language

UVa Online Judge

UVa Online Judge has hundreds of problems similar to those used in programming contests. You can do these exercises at your own leisure in a wide number of languages.

The site also runs contests from time to time for those interested in participating in coding competitions.

Sphere Online Judge (SPOJ)

SPOJ is essentially a large database of programming problems in a variety of languages.

Here, you can select your preferred programming language and check out exercises to solve in that particular language. The above link will take you to their index of C programming exercises.

Exercises from "The C Programming Language"

The C Programming Language Exercises website maintains a list of exercises from the book, "The C Programming Language."

In order to view the exercises, navigate down to the area that says "solutions" and select a chapter. The next page will show each exercise as well as a link to its solution.

The C Puzzle Book

If you're looking for a book full of exercises, I recommend "The C Puzzle Book." It's chock full of problems written with the C programming language in mind. It's written so that the output of the program is actually the solution so that you can quickly and easily see if you're correct.

Scroll to Continue

The book covers topics from a variety of angles giving readers a full look at syntax and semantics to give readers a full understanding of the language.

© 2012 Melanie Palen


David Trujillo Uribe from Medellin, Colombia on November 26, 2013:

I haven´t continued a programming course that i purchased at Wanna start over after reading this

jkchandra on March 15, 2013:

This is really interesting and very informative. I really like this hub and I am going to definitely bookmark this because I am trying to hone my skills in programming to use a game engine to create 2D-3D games as a hobby of mine. I've actually gotten pretty good at the basics when it comes to 2D. I have some previous experience in programming since high school and also have taken a course in computer science for mainly programming and until the last few months I decided to get back into computer programming since high school which is like years ago. I have been sifting through many books and articles here and there, but this is amazing. I had no idea that hubpages would have articles about the concept and yours is really great. I will be coming back and checking from time to time for some pointers. Thanks so much!

kimsal on February 09, 2013:

I need c program exercises

Terrye Toombs from Somewhere between Heaven and Hell without a road map. on August 11, 2012:

You should hand out aspirin with these kinds of hubs, Mel! :)

Christy Birmingham from British Columbia, Canada on August 11, 2012:

What an interesting read, thanks!

Related Articles