Var a, b, c: integer; begin writeln('введите стороны треугольника'); readln(a, b, c); if a < (b + c) then if b < (a + c) then if c < (a + b) then writeln('существует, P = ', a + b + c) else writeln('не существует'); end.
Const n = 10; var a: array[1..n] of integer; i, j, t: integer; flag:boolean;
begin Randomize; Writeln('Исходный массив'); for i := 1 to n do begin a[i] := random(101)-50; Write(a[i]:4) end; Writeln; i:=1; repeat flag:=true; for j := 1 to n-i do if a[j] > a[j+1] then begin t := a[j]; a[j] := a[j+1]; a[j+1] := t; flag:=false end; Inc(i); until (i>n-1) or flag; Writeln('Отсортированный по возрастанию массив'); for i := 1 to n do Write(a[i]:4); Writeln end.
public class Main { public static BufferedReader READER = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int N = Integer.parseInt(READER.readLine()); int[] array = new int[N]; for(int i = 0; i < array.length; ++i) array[i] = Integer.parseInt(READER.readLine()); System.out.println("Negative: " + Main.function(array)); } public static boolean function(int[] array) { for(int number : array) if(number >= 0) return false; return true; } }
begin
writeln('введите стороны треугольника');
readln(a, b, c);
if a < (b + c) then
if b < (a + c) then
if c < (a + b) then writeln('существует, P = ', a + b + c)
else writeln('не существует');
end.