x = 3
y = 15
Код:
int x = -3, y = -1;
do
{
if (y > x)
{
y -= 5;
x += 6;
}
else
{
y /= 4;
x += 7;
}
}
while (x <= 0);
y += 21;
Console.WriteLine("x = " + x);
Console.WriteLine("y = " + y);
Console.ReadKey();
Объяснение:
x=-3, y=-1
-3 > 0 - Нет-1 > -3 - Даy = -1 - 5 = -6x = -3+6 = 33 > 0 - Даy = -6+21 = 15#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
int n;
cout << "Введите число" << endl;
cin >> n;
while (n > 0) {
(n%2 == 0) ? cout << "0" : cout << "1";
(n%2 == 0) ? n = (n) / 2 : n = (n-1) / 2;
}
cout << endl;
system("pause");
return 0;
}
var ch,new,st_10:integer;
begin
writeln('Введи число');
readln(ch);
st_10:=1;
while ch<>0 do
begin
new:=new+(ch mod 2)*st_10;
ch:=ch div 2;
st_10:=st_10*10;
end;
writeln('Число в двоичной системе сч.- ',new);
end.
Объяснение:
1)язык c++, 2) Паскаль, поставь лайк )
Program n1;
function pr(a:longint):boolean;
var i:longint;
begin
if a<2 then pr:=false
else
begin
pr:=true;
for i:=2 to round(sqrt(a)) do
if a mod i=0 then pr:=false;
end;
end;
const n=15;
var a:array[1..n] of integer;
i,k:integer;
begin
randomize;
k:=0;
for i:=1 to n do a[i]:=random(100);
writeln('массив: ');
for i:=1 to n do write(a[i],' ');
writeln;
for i:=1 to n do
if pr(a[i]) then k:=k+1;
writeln('кол-во простых чисел: ',k);
end.