**C language**learned by

**suffering**

**C language**learned by

**suffering**

### Exercise 4

##### fundamental knowledge

Q1-1

What do you call a string enclosed in ""?

Q 1-2

Instead of the x symbol in math, which symbol is used in C?

Q1-3

Instead of the ÷ symbol in mathematics, which symbol is used in C?

Q1-4

What is the system called in C to represent real numbers?

##### program read-only

How would the following program appear when executed?

Q2-1

```
#include <stdio.h>
int main(void)
{
printf("%d\n", 20 / 7);
printf("%f\n", 20.0 / 7.0);
return 0;
}
```

##### program writing

Q3-1

Create a program that calculates 40 divided by 13 and displays the formula, quotient and remainder.

##### descriptive expression

Q4-1

In C, if you divide by an integer, the

If the result is not divisible, the result is truncated, but

Briefly explain why.

If the result is not divisible, the result is truncated, but

Briefly explain why.

##### Basic Knowledge (sample answers)

Solution 1-1

string literal

Solution 1-2

*

*Read as asterisk.

Solution 1-3

/

*Read as slash.

Solution 1-4

floating point representation

##### Program reading (example solution)

Solution 2-1

2

2.857143

2.857143

*Note that integer divisors are rounded down, not rounded up.

*Answers to real numbers should be correct to about two decimal places.

Question

##### Program writing (example of solution)

Solution 3-1

```
#include <stdio.h>
int main(void)
{
printf("%d / %d = %d ... %d\n", 40, 13, 40 / 13, 40 % 13);
return 0;
}
```

*The correct answer is correct even if the symbols for divide and remainder are different.

*Expressions shown as strings are also correct, but the conversion specifier (%d) should be used.

*If no calculation is performed and the answer is a string, it is a wrong answer.

Question

##### Short Answer Type (Sample Answer)

Solution 4-1

Rounding off the quotient, when you do the reverse calculation, quotient times the number to be divided, you get

A discrepancy arises where the result is greater than the original number to be divided.

Therefore, it is better to truncate because it reduces the inconsistency and the calculation error

A discrepancy arises where the result is greater than the original number to be divided.

Therefore, it is better to truncate because it reduces the inconsistency and the calculation error

#### About this Site

The C language (bitter C), which is learned by suffering, is

This is the definitive C language introductory site.

It systematically explains the basic functions of the C language and

It is as complete as or more complete than any book on the market.