00001: #include <stdio.h>
00002:
00003: int main()
00004: {
00005: printf ("Characters: %c %c \n", 'a', 65);
00006: printf ("Characters: %d %d \n", 'a', 65);
00007: printf ("Decimals: %d %d\n", 1977, 65000000);
00008: printf ("Preceding with blanks: %10d \n", 1977);
00009: printf ("Preceding with zeros: %010d \n", 1977);
00010: printf ("Some different radixes: %d %x %o %#x %#o \n",
00011: 100, 100, 100, 100, 100);
00012: printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);
00013: printf ("%s \n", "A string");
00014: int x;
00015: float y;
00016: printf("Enter a decimal and a floating point number\n");
00017: scanf("%d %f", &x, &y);
00018: printf("You entered %d %lf\n", x, y);
00019:
00020: char s[1];
00021: printf("Enter a string\n");
00022: scanf("%s", s);
00023: printf("You entered %s\n", s);
00024: return 0;
00025: }
00026:
|