Program lol (input, output); 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.
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;
}