- ..clause 1..: Basic knowledge
- ..clause 2..: Program readout
- Memo
- ..clause 4..: Description type
- ..clause 5..: Basic knowledge(example solution)
- ..clause 6..: Program readout(example solution)
- Memo(example solution)
- ..clause 8..: Description type(example solution)
[ 1-1 ]
The function used to input the numerical value from the keyboard
Example solution
[ 1-2 ]
The sign put before the variable identifier : in the place where the above-mentioned function is used.
Example solution
[ 2-1 ]
For what is calculated is the following program a program?
Judging from the content of processing and the variable identifier, answer.
#include <stdio.h> int main(void) { int side,high,square; scanf("%d,%d",&side,&high); square = side * high / 2; printf("%d\n",square); return 0; }
Example solution
[ 3-1 ]
The price of one discount, three discounts, five discounts, and eight discounts when you input the fixed price
Make the program that does the list display.
The amount of money of the result doesn't care about the real number though the display by the integral value is preferable either.
Example solution
[ 4-1 ]
Actually, the scanf function is hardly used in the program for which reliability is necessary.
Explain it concisely why.
[ 1-1 ]
Scanf function
- It is other many.
Problem
[ 1-2 ]
Problem
[ 2-1 ]
The program it that calculates the area of a triangle
It understands from the content of the variable identifier (vicinity and height and area) and processing (vicinity × height ÷2).
- Even if the reason is not described, it is assumed that it answers correctly.
- Do not only numerate the program mechanically however slowly.
Come to be able to read it including the meaning of the program.
Problem
[ 3-1 ]
#include <stdio.h> int main(void) { int price; Printf ("Input the fixed price"); scanf("%d",&price); Printf ("One discount = %d yen \n" (int) (price * 0.9)); Printf ("Three discounts = %d yen \n" (int) (price * 0.7)); Printf ("Five discounts = %d yen \n" (int) (price * 0.5)); Printf ("Eight discounts = %d yen \n" (int) (price * 0.2)); return 0; }
- If you want to specify that it is one discount though one discount is assumed to be 0.9 times here
Input the fixed price: 198.
One discount = 178 yen
Three discounts = 138 yen
Five discounts = 99 yen
Eight discounts = 39 yen
(int) It seems to be tenth or more [hi] and it becomes it if it is assumed (price * (1 - 0.1)).
- You may substitute it making the variable at each discount.
- The result may be a real number.
- There is somewhat possibility that the result is different depending on the computational method.
- Attention of leaving putting [ruwo] easily in variable by scanf function.
Problem
[ 4-1 ]
The scanf function : because it cannot check the inputting error.