Skip to content

Project · C Programming (from zero to systems)

Project: a campus ATM simulator

Projectbeginner· about 5 hours· 7 steps

The brief

Build a console ATM for a college campus: it checks the PIN with three tries, follows withdrawal rules, counts out Rs 500, 200 and 100 notes, shows a menu with a balance and a mini statement, and never hangs on bad input. The note-counting rule is written and tested in JavaScript first.

Why it matters

ATMs, ticket machines and vending machines run small C programs exactly like this: a menu loop, input checks, a running balance and a short history in a fixed-size array. Building one end to end, with every rule tested, is a good first portfolio program and a common mini-project in Indian B.Tech and diploma labs.

Skills you practise

  • functions
  • if, switch and loops
  • integer / and %
  • strings and strcmp
  • arrays as a history
  • snprintf
  • checking scanf's return value

You need

  • gcc (Linux, macOS with Xcode command line tools, or Windows with MSYS2 or WSL)

What you will have at the end

notes.js with a tested notes(), and atm.c: a complete ATM simulator with a PIN check, withdrawal rules, note counting, a menu, a mini statement and safe handling of bad input.

How it is marked (rubric, 100 points)
Correct behaviourEvery check passes: notes, rules, PIN tries, menu, mini statement and bad input.40
Program structureSmall functions with prototypes, a clear switch, constants named with #define, no copy-pasted blocks.25
Safe inputEvery scanf return value is checked, strings have width limits (%9s), and the program cannot loop forever.20
Clean build and tidy outputNo warnings with -Wall -Wextra and output exactly in the required formats.15

0/7 steps done

Step 1 of 7

Count the notes, tested in JavaScript

notes(amount) returns [500s, 200s, 100s], biggest notes first, or null for a bad amount.

An ATM gives the biggest notes it can first. Integer division tells you how many 500s fit, and the remainder (%) is what is left for the 200s, then the 100s. For 1800: 3 × 500 = 1500, the 300 left is 1 × 200 and 1 × 100.

An amount that is 0, negative or not a multiple of 100 cannot be paid in these notes, so return null. Write it here first; the C function in step 2 is the same three lines with / and %.

Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.