how to print int in c
To print an integer in C, you can use the printf
function from the standard library. Here's an example:
#include <stdio.h>
int main() {
int num = 10;
printf("%d\n", num);
return 0;
}
In this example, the printf
function is used to print the value of the num
variable, which is an integer. The %d
format specifier is used to indicate that an integer should be printed. The \n
is used to print a newline character after the integer.
When you run this program, it will output 10
to the console.