//Описание добавить не вышло на сайт, посему - в файле
#include "stdafx.h" #include <conio.h>
void swap(short &a, short &b) { short c = a; a = b;
b = c; }
void sort(short &a, short &b, short &c) { short min = a, max = c; if (min > b) min = b; if (min > c) min = c; if (max < a) max = a; if (max < b) max = b; b = a + b + c - min - max; a = min; c = max; }
if ((a1 == a2) && (b1 == b2) && (c1 == c2)) printf("Boxes are equal"); else if ((a1 <= a2) && (b1 <= b2) && (c1 <= c2)) printf_s("The first box is smaller than the second one"); else if ((a2 <= a1) && (b2 <= b1) && (c2 <= c1)) printf_s("The first box is larger than the second one"); else printf_s("Boxes are incomparable");
1) var a: array[0..100] of integer; i, s, n: integer; begin writeln('Введите количество элементов в массиве: '); readln(n); for i := 1 to n do begin a[i] := random(10); write(a[i], ' '); s := s * a[i]; end; writeln; writeln(s); end.
2) var a: array[0..100] of integer; i, s, n: integer; begin writeln('Введите количество элементов в массиве: '); readln(n); for i := 1 to n do begin a[i] := random(10); write(a[i], ' '); end; for i := 1 to n do begin // if (i mod 2=0) then s:=s+a[i]; Раскоментируй, если сумму нужно искать среди четных номеров элементов. // if (a[i] mod 2=0) then s:=s+a[i]; Раскоментируй, если сумму нужно искать среди самих четных элементов. end; writeln; writeln(s); end.
3)var a: array[0..100] of integer; i, s, n, max: integer; begin writeln('Введите количество элементов в массиве: '); readln(n); for i := 1 to n do begin a[i] := random(10); write(a[i], ' '); end; s:=0; for i := 1 to n do begin if (a[i]>s) then s:=a[i]; end; writeln; writeln(s); end.
4)var a: array[0..100] of integer; i, s, n, max: integer; begin writeln('Введите количество элементов в массиве: '); readln(n); for i := 1 to n do begin a[i] := random(10); write(a[i], ' '); end; s:=0; for i := 1 to n do begin if (a[i]>s) and (a[i] mod 3=0) then s:=a[i]; end; writeln; writeln(s); end.
robotX = 2
robotY = 9
paint = 1
ic = 0
ig = 0
while ic < 4:
robotY -= 2
while ig < 4:
robotX += 1
ig = 0
paint = 0
robotX += 2
paint = 1
while ig < 4:
robotX += 1
ig = 0
robotY -= 2
while ig < 4:
robotX -= 1
ig = 0
paint = 0
robotX -= 2
paint = 1
while ig < 4:
robotX -= 1