Program calk; uses crt; var a,b,c,d,x1,x2 : real; begin textcolor(red); gotoxy(10,5); write('вас калькулятор решать квадратные уравнения'); gotoxy(10,6); write('введите а='); readln(a); gotoxy(10,7); write('введите b='); readln(b); gotoxy(10,8); write('введите с='); readln(c); d: =b*b-4*a*c; readln(d) if d< 0 then begin gotoxy(10,9); textcolor(red); write('нет действительных корней') end else begin if d=0 then begin gotoxy(10,10); textcolor(red); x1: =(-b/2*a); write('уравнение имеет один корень и он равен: x1 =',x1: 2: 2,''); end else begin if d> 0 then begin x1: =(-b-sqrt(d))/(2*a); x2: =(-b+sqrt(d))/(2*a); write('уравнение имеет 2 корня и они равны: x1 =',x1: 2: 2,' ','x2=',x2: 2: 2) end; end. в чем
var a, n, b, i, p,s, m:integer;
c:real;
begin
read (n);
a:=n;
b:=0;
c:=0;
p:=1;
while a <> 0 do
begin
a:=a div 10;
b:=b+1;
end;
while b <> 0 do
begin
p:=1;
for m:=1 to b do
p:=p*10;
s:=(n mod p) div (p div 10);
c:=c+s;
end;
b:=b-1;
end;
writeln (c);
end.
program lol (input, output);
var I, a:integer;
begin
a:=0;
for I:=31 to 55 do
begin
if (i mod 2) <> 0 then
a:=a+I;
end;
writeln (a);
end.
var a, b, c, s, I:integer;
begin
read (a, b);
if a<b then
begin
c:=a;
a:=b;
b:=c;
end;
c:=a;
while c > 0 do
begin
while c >= b do
begin
c:=a-b;
if c > 0 then
s:=c;
a:=c;
end;
a:=b;
b:=c;
end;
writeln (s);
end.
program lol (input, output);
var m, n, prod: word;
begin
readln(m, n);
prod := m * n;
while m <> n do
begin
if m > n then
begin
m := m - n
end
else
begin
n := n - m
end
end;
writeln(prod div m)
end.
program lol (input, output);
var a, b, c, e:Integer;
d:real;
begin
read (a, b);
d:=a/b;
c:=trunc(d);
e:=a-(b*c);
writeln ('Частное: ',c);
writeln ('Остаток: ',e);
end.
#include <cmath>
using namespace std;
class Circle
{
private:
double x;
double y;
double r;
public:
Circle();
Circle(double xCo, double yCo, double rad);
double area();
double centre_dist(Circle & c);
bool istouch(Circle & c);
};
Circle::Circle()
{
cout << "Enter x coord: ";
cin >> x;
cout << "Enter y coord: ";
cin >> y;
cout << "Enter radius: ";
while (cin >> r && r < 0)
{
cout << "Radius can't be negative\n";
cout << "Enter radius: ";
}
}
Circle::Circle(double xCo, double yCo, double rad) : x(xCo), y(yCo), r(rad)
{
if (r < 0)
{
cout << "Radius can't be negative\n";
cout << "Radius set to 0\n";
r = 0;
}
}
double Circle::area()
{
return 3.1415926 * r * r;
}
double Circle::centre_dist(Circle & c)
{
return sqrt((x - c.x) * (x - c.x) + (y - c.y) * (y - c.y));
}
bool Circle::istouch(Circle & c)
{
return (this->centre_dist(c) <= r + c.r) ? true : false;
}
int main()
{
Circle c1;
Circle c2(0, 0, 5);
cout << "area of c2: " << c2.area() << endl;
cout << "centre distance: " << c2.centre_dist(c1) << endl;
cout << "is touch: ";
c2.istouch(c1) ? cout << "yes" : cout << "no";
cout << endl;
return 0;
}