type a = array[0..999] of Integer; var B, num: a; var N, k: integer;
procedure SimpleNumber(B: a); begin for var i := 0 to N-1 do begin for var j := 2 to 9 do begin if B[i] mod num[j] <> 0 then k += 1; end; if k = 8 then begin write('Есть простое число'); break; end else if (k <> 8) and (i = N-1) then write('Нет простых чисел'); k := 0; end; end;
begin for var i := 2 to 9 do begin num[i] := i; end; read(N); for var i := 0 to N-1 do read(B[i]); SimpleNumber(B); end.
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main() {
vector<float> coordinates;
string a;
getline(cin, a);
string buffer;
for(int i = 0; i<a.length(); ++i) {
if(a[i]!=' ') {
buffer+=a[i];
} if(a[i]==' '||i==a.length()-1) {
if(buffer[buffer.length()-1]=='.') {
buffer+="0";
}
float num = stof(buffer);
coordinates.push_back(num);
buffer = "";
}
}
if(coordinates.size()!=4) {
cout << "wrong data. example: 1.1 2.2 3.3 4.4";
}
float result;
int temp1, temp2, temp3, temp4;
temp1 = coordinates[0]-coordinates[2];
temp2 = coordinates[1]-coordinates[3];
temp1 = temp1 * temp1;
temp2 = temp2 * temp2;
temp3 = temp1 + temp2;
result = sqrt(temp3);
cout << result;
}
type a = array[0..999] of Integer;
var B, num: a; var N, k: integer;
procedure SimpleNumber(B: a);
begin
for var i := 0 to N-1 do begin
for var j := 2 to 9 do begin
if B[i] mod num[j] <> 0 then
k += 1;
end;
if k = 8 then begin
write('Есть простое число');
break;
end
else if (k <> 8) and (i = N-1) then
write('Нет простых чисел');
k := 0;
end;
end;
begin
for var i := 2 to 9 do begin
num[i] := i;
end;
read(N);
for var i := 0 to N-1 do
read(B[i]);
SimpleNumber(B);
end.