c printf affichage
#include <stdio.h>
int main() {
int num = 42;
printf("The value of num is: %d\n", num);
return 0;
}
Include the standard input-output library (
stdio.h
).Define the
main
function.Declare an integer variable named
num
and initialize it with the value42
.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 ofnum
will replace%d
during execution. The "\n" represents a newline character for formatting.Return 0 from the
main
function, indicating successful execution.