Today, shange explained the conversion of hexadecimal and 32 keywords in C. Then I tried to calculate a conversion question.
Binary Conversion to decimal
1010 = 1*2 ^ 3 + 0*2 ^ 2 + 1*2 ^ 1 + 0*2 ^ 0 = 10
Decimal to binary
10 = 10/2 remainder 0
5/2 remainder 1
2/2 remainder 0
1/2 remainder 1
1 # include <stdio. h> 2 3 int main (INT argc, const char * argv []) 4 {5 int A = sizeof (INT); 6 printf ("A = % d \ n ", a); 7 8 char B = sizeof (char); 9 printf ("B = % d \ n", B); 10 11 long c = sizeof (long ); 12 printf ("c = % LD \ n", c); 13 14 float d = sizeof (float); 15 printf ("d = % F \ n", d ); 16 17 Double E = sizeof (double); 18 printf ("e = % lf \ n", e); 19 20 short F = sizeof (short ); 21 printf ("F = % d \ n", f); 22 23 int I, j; 24 int N = 4; // set the number of rows in the image to 25 26 for (I = 1; I <= N; I ++) // repeat the output of N rows to 27 {28 for (j = 1; j <= 2 * n-I; j ++) // repeat each character 29 If (j <= i-1) 30 printf (""); // output the leading space 31 else32 printf ("*"); // output the leading space * 33 34 printf ("\ n "); 35} 36 37 float G = 2.3; 38 printf ("G = %. 4f \ n ", g); 39 40 return 0; 41}
Output result:
A = 4
B = 1
C = 8
D = 4.000000
E = 8.000000
F = 2
*******
*****
***
*
G = 2.3000
Program ended with exit code: 0
Summary of classes on the second day of Camp David