printf() and scanf()

  1. printf()

  • is used for output.It prints the given statements to the console.

  • The general form of printf() function is: printf(“<format string>”,<list of variables>”);

  • <format string> can contain : 

    • %f for floating/real values

    • %d for integer values

    • %c for character values

  1. scanf()
  • is used for the input.It reads the input data from the  console.

  • The ampersand (&) before the variables in scanf() function is a must. & is an “Address of” operator.It gives location used by variables in memory.