c printf affichage

#include <stdio.h>

int main() {
    int num = 42;

    printf("The value of num is: %d\n", num);

    return 0;
}
  1. Include the standard input-output library (stdio.h).

  2. Define the main function.

  3. Declare an integer variable named num and initialize it with the value 42.

  4. Use the printf function to display the formatted output. The format string is "The value of num is: %d\n", where %d is a format specifier for an integer. The actual value of num will replace %d during execution. The "\n" represents a newline character for formatting.

  5. Return 0 from the main function, indicating successful execution.