Advanced Language Programming-Experiment 2 Basic Types and Operations

1. Exercises at the upper limit of the classroom
3. Read the following program and write the running result:
Write the result
analysis:

(1) The remainder of a is 0;

(2) b Take the quotient without rounding.

(3) c = b ++, execute c = b first, then execute b = b + 1.

(4) Double and float type data printing prints 6 digits after the decimal point by default. If you want to display more, you can use the form of% .nf.

(5) 15/10 belong to integer type, after taking the quotient, display 6 digits after the decimal point.

(6) d / 10 is an operation between float types, so it can display decimals.

answer:

#include <stdio.h>
int main(){    
    printf("0,2,1,15.000000,1.000000,1.500000");
return 0;
}

2. Exercises under the classroom
1. Assignment expressions and assignment statements, and write the results of the programAssignment expressions and assignment statements to write the results of program execution

#include "stdio.h"
main()
{
    printf("_______________________");
}

1) There are 256 ASCII characters from 0-255, c = 330, after 255, it will start from 0, 330-255 = 74, ASCII = 74, the character is J.

ASCII 为48,字符为0
ASCII 为65,字符为A
ASCII 为97,字符为a

2) \ 141 is the octal number character represented by 141. Converting this octal 141 to decimal is 97. Check the ASCII code, 97 is a, so the character a will be output.

'\101'表示ASCII为八进制101(对应十进制65)的字符,即 ‘ A ’ .
 八进制转十进制   (101)8=(1*8^2+0*8^1+1*8^0=6510
Published 10 original articles · Like1 · Visits 190

Guess you like

Origin blog.csdn.net/weixin_39475542/article/details/105328773