Skip to main content

Section 2.2 WriteConditional-Exercise

Subgoals for writing conditionals.

  1. Define how many mutually exclusive paths are needed
  2. Order paths from most restrictive to least restrictive
  3. Write conditional statement with Boolean expression
  4. Follow with true path including action in indentation
  5. Repeat 3 and 4 until all paths are included
  6. (Optional) Follow with else path including action in indentation

Subsection 2.2.1 WrCond-Parsons-Problem

Exercises Exercises

1.
Put the code in the right order to create a program that will ask the user for 3 numbers (1 to 10 inclusive) for variables a, b, and c, and print the value of each variable. Then compare a to b, a to c, and b to c, and print statements for each comparison, reporting for each pair of variables if they are equal, greater than, or less than.
You have attempted of activities on this page.