Enter
You can enter several real variables from the input stream and write them to variables in the standard way:
var x, y: real;
read(x, y);
The first number goes into the
\(x\) variable, the second goes into the
\(y\)
Output
When displaying real numbers, scientific format is selected by default.
You can customize the output as needed according to the condition of the problem. After the number, a colon indicates the total number of positions that will be allocated to the number, and then another colon - the number of positions allocated to the fractional part. If after the first colon there is a number that is less than the sum of the number of characters in the integer part of the number, the space allotted for the dot separating the fractional and integer parts (1 character is allocated for this) and the number of characters allotted for the fractional part, then simply a number with given the allotted number of characters to the fractional part. Otherwise, additional spaces are written before the number. Therefore, if you do not know how many characters the integer part will take you, you can simply write 0 after the first colon, and then the whole number will be displayed without spaces before it.
Example:
real x := 1.0/6;
writeln(x:12:9); // set to display 9 decimal places and a total of 12 decimal places per number, taking into account the separating point
The screen will display
_0.166666672