practice_C

Operators and Macros

Exercises

  1. Use a macro to calculate the area and circumference of a circle.
  2. Use macros to calculate the square and cube of a number.
  3. Check whether a number is even or odd using the remainder operator.
  4. Swap two numbers without a temporary variable.

Concepts practiced

#define, arithmetic operators, assignment, and operator precedence.

Click here for explanation and solution.