Задача 13 урок 9
Primary tabs
У вас есть три числа (три переменные) найдите их медиану (link is external)
program zadacha13;
var a, b, c :integer;
begin
writeln('Vvedite pervoe cheslo:');
readln(a);
writeln('Vvedite vtoroe cheslo:');
readln(b);
writeln('Vvedite tretie cheslo:');
readln(c);
if ((a>b) and (a<c)) or ((a<b) and (a>c)) then
writeln('Mediana chisel: ',a) else begin
if ((b>a) and (b<c)) or ((b<a) and (b>c)) then
writeln('Mediana chisel: ',b) else
if ((c>a) and (b<c)) or ((c<a) and (b>c)) then
writeln('Mediana chisel: ',c);
end;
readln();
end.- Log in to post comments
- 2680 reads
vedro-compota
Sun, 11/07/2021 - 13:06
Permalink
учитывать случай равенства,
учитывать случай равенства, напр. для значений
медиана = 5
_____________
матфак вгу и остальная классика =)
Denisyndi
Mon, 11/08/2021 - 18:07
Permalink
С учетом равенства
program zadacha13; var a, b, c :integer; begin writeln('Vvedite pervoe cheslo:'); readln(a); writeln('Vvedite vtoroe cheslo:'); readln(b); writeln('Vvedite tretie cheslo:'); readln(c); if ((a>=b) and (a<=c)) or ((a<=b) and (a>=c)) then writeln('Mediana chisel: ',a) else begin if ((b>=a) and (b<=c)) or ((b<=a) and (b>=c)) then writeln('Mediana chisel: ',b) else if ((c>=a) and (b<=c)) or ((c<=a) and (b>=c)) then writeln('Mediana chisel: ',c); end; readln(); end.vedro-compota
Sun, 11/14/2021 - 13:39
Permalink
исправить форматирование
исправить форматирование
_____________
матфак вгу и остальная классика =)
Denisyndi
Mon, 11/15/2021 - 17:44
Permalink
С исправленным форматированием
program zadacha13; var a, b, c :integer; begin writeln('Vvedite pervoe cheslo:'); readln(a); writeln('Vvedite vtoroe cheslo:'); readln(b); writeln('Vvedite tretie cheslo:'); readln(c); if ((a>=b) and (a<=c)) or ((a<=b) and (a>=c)) then writeln('Mediana chisel: ',a) else begin if ((b>=a) and (b<=c)) or ((b<=a) and (b>=c)) then writeln('Mediana chisel: ',b) else if ((c>=a) and (b<=c)) or ((c<=a) and (b>=c)) then writeln('Mediana chisel: ',c); end; readln(); end.vedro-compota
Wed, 11/17/2021 - 19:22
Permalink
засчитано
засчитано
_____________
матфак вгу и остальная классика =)