printf() - Formatted output in C

Examples of printing using printf()
A C program using the above printf() function calls.

#include <stdio.h>

int main(void)
{
  int x_val = 42;
  float y = 3.15;
  char letter = 'a';

  printf("output"); 
  printf("age = %d", 16);
  printf("%d %d %f", 2, 5, 3.14159); 
  printf("x = %d", x_val); 
  printf("letter = %c", letter);
  printf("\n\noutput\n"); 
  printf("age = %d\n", 16);
  printf("%d %d %f\n", 2, 5, 3.14159); 
  printf("x = %d\n", x_val); 
  printf("letter = %c\n", letter);
 
  return (0);
}


Output from the above program. Notice the difference the \n makes in the output. outputage = 162 5 3.141590x = 42letter = a output age = 16 2 5 3.141590 x = 42 letter = a