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///
1/* printf example in C */
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
15 return 0;
16}
17
18
19//*******
20
21Characters: a A
22Decimals: 1977 650000
23Preceding with blanks: 1977
24Preceding with zeros: 0000001977
25Some different radices: 100 64 144 0x64 0144
26floats: 3.14 +3e+000 3.141600E+000
27Width trick: 10
28A string
1#include <stdio.h>
2
3int main () {
4 int ch;
5
6 for( ch = 75 ; ch <= 100; ch++ ) {
7 printf("ASCII value = %d, Character = %c\n", ch , ch );
8 }
9
10 return(0);
11}