- •Var X, Left, Right: Real;
- •Var s, Left, Right: Real;
- •Var X, y, z, max: Real;
- •Var X, y, z, s, d: Real;
- •Var X, y: Real;
- •Var n, I: 1..20; f: Comp;
- •Var X,y:Extended;
- •Var a, b, c, p, z: real;
- •22: Write(‘Введіть а’);
- •I: integer
- •I: integer;
- •I: integer;
- •I: integer;
- •I: integer;
- •I: integer;
- •I: integer;
- •Var X, y, z:real;
- •I: integer;
- •I:integer;
- •I:integer;
- •I:integer;
Var X, y, z, max: Real;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
If x>y then max:=x else max:=y;
If z>max then max:=z;
Write(‘Max= ’, max); readln
End.
Який з фрагментів програми пошуку максимального з суми та добутку трьох дійсних чисел X, Y,Z не містить помилок:
a)
Var x, y, z, s, d: Byte;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
s:=x+y+z; d:=x*y*z;
If s>p then Write(‘сума більше: ’ , s , ‘>’ , p) else
If s<p then Write(‘добуток більше: ’ , p , ‘>’ , s) else
Write(‘сума та добуток рівні ’, s , ‘=’ , p); readln
End.
б)
Var x, y, z, s, d: Integer;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
s:=x+y+z; d:=x*y*z;
If s<p then Write(‘сума більше: ’ , s , ‘<’ , p) else
If s<p then Write(‘добуток більше: ’ , p , ‘>’ , s) else
Write(‘сума та добуток рівні ’, s , ‘=’ , p); readln
End.
в)
Var X, y, z, s, d: Real;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
s:=x+y+z; d:=x*y*z;
If s>p then Write(‘сума більше: ’ , s , ‘>’ , p) else
If s>p then Write(‘добуток більше: ’ , p , ‘>’ , s) else
Write(‘сума та добуток рівні ’, s , ‘=’ , p); readln
End.
г)
Var x, y, z, s, d: Double;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
s:=x+y-z; d:=x-y/z;
If s>p then Write(‘сума більше: ’ , s , ‘>’ , p) else
If s<p then Write(‘добуток більше: ’ , p , ‘>’ , s) else
Write(‘сума та добуток рівні ’, s , ‘=’ , p); readln
End.
д)
Var x, y, z, s, d: Double;
Begin
Write(‘Введіть 3-и дійсних числа: ’);
Readln(x,y,z);
s:=x+y+z; d:=x*y*z;
If s>p then Write(‘сума більше: ’ , s , ‘>’ , p) else
If s<p then Write(‘добуток більше: ’ , p , ‘>’ , s) else
Write(‘сума та добуток рівні ’, s , ‘=’ , p); readln
End.
Який з фрагментів програми отримання цілої та дробової частини числа Х не містить помилок:
a)
Var x, y: Integer;
Begin
Write(‘Введіть любе дійсне число х= ? ’ , #8);
Readln(x);
If (x>0) or (Frac(x)< >0) then y:=Int(x) else y:=Int(x)-1
Write(‘[’ , x , ‘] = ’ , y : 1 : 0) {ціла частина}
Write(‘[’ , x , ‘] = ’ , x-y : 1 : 15) {дробова частина}
End.
б)
Var x, y: Double;
Begin
Write(‘Введіть любе дійсне число х= ? ’ , #8);
Readln(x);
If (x>0) or (Frac(x)>0) then y:=Int(x) else y:=Int(x)-1
Write(‘[’ , x , ‘] = ’ , y : 1 : 0) {ціла частина}
Write(‘[’ , x , ‘] = ’ , x+y : 1 : 15) {дробова частина}
End.
в)
Var x, y: Double;
Begin
Write(‘Введіть любе дійсне число х= ? ’ , #8);
Readln(x);
If (x>0) or (Frac(x)<0) then y:=Int(x) else y:=Int(x)-1
Write(‘[’ , x , ‘] = ’ , y : 1 : 0) {ціла частина}
Write(‘[’ , x , ‘] = ’ , x-y : 1 : 15) {дробова частина}
End.
г)
Var x, y: Double;
Begin
Write(‘Введіть любе дійсне число х= ? ’ , #8);
Readln(x);
If (x>0) or (Frac(x)=0) then y:=Int(x-1) else y:=Int(x)-1
Write(‘[’ , x , ‘] = ’ , y : 1 : 0) {ціла частина}
Write(‘[’ , x , ‘] = ’ , x+y : 1 : 15) {дробова частина}
End.
д)
Var X, y: Real;
Begin
Write(‘Введіть любе дійсне число х= ? ’ , #8);
Readln(x);
If (x>0) or (Frac(x)=0) then y:=Int(x) else y:=Int(x)-1
Write(‘[’ , x , ‘] = ’ , y : 1 : 0) {ціла частина}
Write(‘[’ , x , ‘] = ’ , x-y : 1 : 15) {дробова частина}
End.
Який з фрагментів програми обчислення факторіалу не містить помилок:
a)