printf

To display text on the screen, use the printf function. Here are some examples:
  1. printf("hello!\n"); printf("hello!\n ");
  2. printf("hello!"); printf("hello! ");
  3. printf("f(%d) = %f\n", k, sqrt(k) );
  4. printf("%5d %4.6%f\n", k, sqrt(k) );
Notes:
  1. Display the string "hello!" on two separate lines.
  2. Display the string "hello!hello!" on one line.
  3. If k = 2, this displays "f(2) = 1.4142". The "%d" is a place holder for integers and " %f" is a place holder for floating point numbers.
  4. Prints k in a space 5 characters wide, then prints one blank space, then prints the square root of k in with 4 spaces before the decimal point, 6 after it.