Skip to content

Exercise path · C

10 C exercises, in order

From your first line to a complete program you assembled yourself. Each exercise introduces exactly one new idea, runs in this tab, and tells you in plain language what happened.

How the path works

You never start from a blank editor. Every exercise hands you a program that already runs and asks you to change or add one thing, so the first success is minutes away and the last exercise is a program you can read top to bottom and explain. The ideas arrive in this order: output, variables, arithmetic, conditions, loops, loops and conditions, strings and formatting, arrays, putting it together, a complete program.

Run is the check. There is no separate submit button: press Run, and the output is compared with what the exercise asked for. When it is not right, the feedback is a sentence about what happened — the line that differed, or what the error means — rather than a verdict. Hints come one at a time, and the answer opens only after you have run your code at least once, because reading the answer first is how you learn nothing.

Your finished exercises and the code you last had in the editor are saved in this browser, so a half-done exercise is still there tomorrow. Nothing is uploaded and there is no account.

The exercises

  1. Hello, Out LoudA banner with your own name inside it, printed by a C program that you compiled and ran yourself.New idea: printf() puts text on the screen
  2. Name TagA bordered name-tag card with your own name across three of its lines, every one of them fed by a single line of code.New idea: A variable is declared with a type, and holds one value under a name
  3. Party PlannerA pizza order summary that works itself out from the guest list — slices needed, whole pizzas, and the slices that spill past them.New idea: C does arithmetic with + - * / and %, and / between two ints throws away the remainder
  4. Umbrella or NotA rain report card that reads the forecast for you and signs off with a straight answer — take the umbrella, or leave it at home.New idea: if/else chooses between two different blocks of code
  5. CountdownA launch sequence that counts itself down from five to one, announces liftoff and draws a small rocket, with the whole countdown written as one line that runs five times.New idea: a for loop repeats a block a fixed number of times
  6. The Clapping GameA count from one to twenty where every third number is replaced by a clap, so the beat is visible straight down the screen.New idea: An if inside a for loop is decided again on every pass
  7. The ScoreboardA game scoreboard where every name, score and bar of # characters lands in the same column, built entirely from printf's own field-width numbers rather than spaces typed by hand.New idea: a number between % and the conversion letter gives printf a fixed field width
  8. Packing ListA travel packing checklist with a banner, one tick-box line for every item on the list, and a footer that counts them for you.New idea: An array holds several values of one type in order, indexed from zero with []
  9. Rainfall WeekA seven-day rainfall chart with a row for every day, the week added up underneath it, and the wettest of the seven days picked out.New idea: A variable declared before a loop carries its value from one pass to the next
  10. The Cafe TicketA printed cafe receipt with the shop name at the top, three item rows in straight columns, a subtotal, a service charge the program works out itself, a total, and a thank-you line at the bottom.New idea: Assembling a complete program from parts you already know

After the path

The C lessons go deeper on every idea the exercises introduced, and the practice problems are the next step up: graded against hidden tests, and a genuine challenge. Everything you can practise C with on this site is gathered on the C practice hub. The same path also exists in Python, JavaScript, TypeScript, Java, C++, C#, Go, PHP, Ruby, SQL, R and Bash & the Shell.