print_ex.c
00001 #include <stdio.h>
00002
00003 int main() {
00004 printf("|%d|\n", 14);
00005 printf("|%d|\n", -14);
00006 printf("|%+d|\n",14);
00007 printf("|%+d|\n",-14);
00008 printf("|% d|\n",14);
00009 printf("|% d|\n",-14);
00010 printf("|%x|\n", 0x14ab);
00011 printf("|%X|\n", 0x14ab);
00012 printf("|%#x|\n",0x14ab);
00013 printf("|%#X|\n",0x14ab);
00014
00015 printf("|%o|\n", 14);
00016 printf("|%#o|\n",14);
00017
00018 printf("|%10d|\n", 14);
00019 printf("|%10.4d|\n",14);
00020 printf("|%.4d|\n", 14);
00021 printf("|%*.4d|\n", 10,14);
00022 printf("|%*.*d|\n", 10,4,14);
00023
00024 printf("|%f|\n", 1.234567890123456789e5);
00025 printf("|%.2f|\n", 1.234567890123456789e5);
00026 printf("|%.20f|\n", 1.234567890123456789e5);
00027 printf("|%20.2f|\n",1.234567890123456789e5);
00028
00029 printf("|%e|\n", 1.234567890123456789e5);
00030 printf("|%.5e|\n", 1.234567890123456789e5);
00031 printf("|%.20e|\n", 1.234567890123456789e5);
00032 printf("|%20.2e|\n",1.234567890123456789e5);
00033
00034 printf("|%.5g|\n",1.234567890123456789e-5);
00035 printf("|%.5g|\n", 1.234567890123456789e5);
00036 printf("|%.5g|\n",1.234567890123456789e-3);
00037 printf("|%.10g|\n",1.234567890123456789e5);
00038
00039 return 0;
00040 }