how to print a long int in c code example

Example 1: how to print int in c

#include <stdio.h>
int main() {   
    int number;   
    printf("Enter an integer: ");  
    scanf("%d", &number);
    printf("You entered: %d", number);    
    return 0;
}

Example 2: printf data types c

c	Character
d or i	Signed decimal integer
e	Scientific notation (mantissa/exponent) using e character
E	Scientific notation (mantissa/exponent) using E character
f	Decimal floating point
g	Uses the shorter of %e or %f
G	Uses the shorter of %E or %f
o	Signed octal
s	String of characters
u	Unsigned decimal integer
x	Unsigned hexadecimal integer
X	Unsigned hexadecimal integer (capital letters)
p	Pointer address
n	Nothing printed
%	Character

Tags:

C Example