Odd or even? (parity.c)

Things to watch for in this code:

  • The indentation for both the main function and the if/else statements
  • The placement of dashes all around the code (between operators and numbers, after commas etc)
  • Where to put the semicolon! Function calls need to have a semicolon in the end, however if condition should typically not be followed by a semicolon!

This is available in more detail in the coding style document

Also look for what has changed from the starter code. See what different and figure out why we changed that.

The things to look for in the algorithm

  • How the condition is formed – all of the exit conditions are named and the condition itself lies in a comment connected to the decision node
  • All of the arrow heads showing the direction of flow in the algorithm
  • No language specific commands are listed
  • End node includes a comment (this is because programs may have multiple end scenarios, some of which may for example come from errors.