1/* printf example */
2#include <stdio.h>
3
4int main()
5{
6 printf ("Characters: %c %c \n", 'a', 65);
7 printf ("Decimals: %d %ld\n", 1977, 650000L);
8 printf ("Preceding with blanks: %10d \n", 1977);
9 printf ("Preceding with zeros: %010d \n", 1977);
10 printf ("Some different radices: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);
11 printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);
12 printf ("Width trick: %*d \n", 5, 10);
13 printf ("%s \n", "A string");
14 return 0;
15}
1#include <stdio.h>
2
3int printf(const char *format, ...);
4
5int main(void)
6{
7 int nb = 20;
8
9 printf("Hello World !\n");
10 printf("%d\n", nb);
11 printf("%s/%d\n", "Nice", 20);
12 return (0);
13}
14
15/// output :
16///
17/// Hello World !
18/// 20
19/// Nice/20
20///