#include<conio.h>
#include<stdio.h>
#include<iostream.h>
float Max(float a,float b)
{
if (a > b) then return a
else return b;
}
float Min(float a,float b)
if (a < b) then return a
int main()
float x,y,z,p;
clrscr;
cout<<"Введите 3 числа: ";
cin>>x;
cin>>y;
cin>>z;
if (z < 0) p = Max (x, y)
else p =Min (x, y);
cout<<" \nP равно:"<<p<<"\n";
getch();
return 0;
{ FreePascal 2.6.4}
program test;
uses
crt;
var
a, b, c, d : integer;
f : longint;
procedure swap (var x : integer; var y : integer);
var z : integer;
begin
z := x;
x := y;
y := z;
end;
function nod (m, n : integer) : integer;
begin
while m<>n do begin
if m>n
then
m:=m-n
else
n:=n-m;
end;
nod := m;
end;
function max (a,b : integer) : integer;
begin
if a>b
then max := a
else max := b;
end;
function min (x, y, z : integer) : integer;
var m : integer;
begin
m := x;
if y<m then m := y;
if z<m then m := z;
min := m;
end;
function mypow (a, b : integer) : integer;
var e, f : integer;
begin
f := 1;
for e:=1 to b do f := f*a;
mypow := f;
end;
function fact(a : integer) : longint;
var
i : integer;
res : longint;
begin
res := 1;
for i := 1 to a do res := res*i;
fact := res;
end;
begin
clrscr;
writeln('Test of function SWAP');
write('Input A: ');
readln(a);
write('Input B: ');
readln(b);
swap(a, b);
writeln('A=', a, ', B=', b);
writeln;
writeln('Test of function NOD');
write('Input A: ');
readln(a);
write('Input B: ');
readln(b);
c := nod(a, b);
writeln('NOD(', a, ',', b, ')=', c);
writeln;
writeln('Test of function MAX');
write('Input A: ');
readln(a);
write('Input B: ');
readln(b);
c := max(a, b);
writeln('MAX(', a, ',', b, ')=', c);
writeln;
writeln('Test of function MIN');
write('Input A: ');
readln(a);
write('Input B: ');
readln(b);
write('Input C: ');
readln(c);
d := min(a, b, c);
writeln('MIN(', a, ',', b, ',', c, ')=', d);
writeln;
writeln('Test of function POW');
write('Input A: ');
readln(a);
write('Input B: ');
readln(b);
c := mypow(a, b);
writeln('POW(', a, ',', b, ')=', c);
writeln;
writeln ('Test of function FACT (not large than 12!)');
write('Input A: ');
readln(a);
f := fact(a);
writeln(a, '!=', f);
writeln;
readkey;
end.
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
float Max(float a,float b)
{
if (a > b) then return a
else return b;
}
float Min(float a,float b)
{
if (a < b) then return a
else return b;
}
int main()
{
float x,y,z,p;
clrscr;
cout<<"Введите 3 числа: ";
cin>>x;
cin>>y;
cin>>z;
if (z < 0) p = Max (x, y)
else p =Min (x, y);
cout<<" \nP равно:"<<p<<"\n";
getch();
return 0;
}