Skip to content

Instantly share code, notes, and snippets.

@radbasa
Last active August 29, 2015 14:01
Show Gist options
  • Save radbasa/bcfcd4e7667aee86c246 to your computer and use it in GitHub Desktop.
Save radbasa/bcfcd4e7667aee86c246 to your computer and use it in GitHub Desktop.
optimization exercise
// all input data validated
// w: boolean
// x: int age
// z: 'M' or 'F'
#define true 1
#define false 0
if ( w == true ) {
if ( z == "M" ) {
if ( x >= 20 && x <= 65 ) {
// statements 1
} else if ( x < 20 ) {
// statements 3
}
} else {
if ( x >= 20 ) {
if ( x <= 65 ) {
// statements 1
// statements 2
} else {
// statements 2
}
}
}
} else {
if ( z == "M" ) {
if ( x < 20 ) {
// statements 3
}
} else {
if ( x >= 20 ) {
// statements 2
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment