Skip to content
18 changes: 18 additions & 0 deletions Seminars/Seminar05/Self/Task1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
class Program
{
static void Main()
{
for (int i = 1; i <= 50; ++i) {
if (i == 20) {
continue;
}
if (i % 2 == 0 && i % 3 == 0) {
System.Console.WriteLine(i + " делится на 2 и 3");
}
else {
System.Console.WriteLine(i + " не делится на 2 и 3");
}
}
}
}
15 changes: 15 additions & 0 deletions Seminars/Seminar05/Self/Task10/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
class Program
{
static double G(double x) {
if (x <= 0.5) {
return Math.Sin(Math.PI / 2);
}
return Math.Sin(Math.PI * (x - 1) / 2);
}
static void Main()
{
double x = double.Parse(Console.ReadLine());
System.Console.WriteLine(G(x));
}
}
29 changes: 29 additions & 0 deletions Seminars/Seminar05/Self/Task2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
class Program
{
static void Main()
{
int kint = 0, kdouble = 0, knan = 0;
string s;
do {
s = Console.ReadLine();
int a;
double b;
bool isint = int.TryParse(s, out a);
bool isdouble = double.TryParse(s, out b);
if (isint) {
++kint;
}
else if (isdouble) {
++kdouble;
}
else {
++knan;
}
}
while (s != "0");
System.Console.WriteLine("int = " + kint);
System.Console.WriteLine("double = " + kdouble);
System.Console.WriteLine("nan = " + knan);
}
}
15 changes: 15 additions & 0 deletions Seminars/Seminar05/Self/Task3/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
class Program
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
double s = 0;
for (int i = 1; i <= n; ++i) {
double x = a / n * i;
s += a / n * x * x;
}
System.Console.WriteLine(s);
}
}
16 changes: 16 additions & 0 deletions Seminars/Seminar05/Self/Task4/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
class Program
{
static void Main()
{
double s = 0;
int a = 1, b = 2, c = 3;
for (int i = 1; i <= 1000; ++i) {
s += 1.0 / (a * b * c);
++a;
++b;
++c;
}
System.Console.WriteLine(s);
}
}
13 changes: 13 additions & 0 deletions Seminars/Seminar05/Self/Task5/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
class Program
{
static void Main()
{
int k = int.Parse(Console.ReadLine());
double ans = 0;
for (int i = 1; i <= k; ++i) {
ans += 1.0 / i;
}
System.Console.WriteLine("{0:F4}", ans);
}
}
12 changes: 12 additions & 0 deletions Seminars/Seminar05/Self/Task6/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
class Program
{
static void Main()
{
for (int i = 100; i <= 999; ++i) {
if (i % 10 == i / 10 % 10 && i % 10 == i / 100) {
System.Console.WriteLine(i);
}
}
}
}
15 changes: 15 additions & 0 deletions Seminars/Seminar05/Self/Task7/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
class Program
{
static void Main()
{
int x = int.Parse(Console.ReadLine());
int a = x;
while (a > 0) {
if (a % 10 != 0) {
System.Console.Write(a % 10);
}
a /= 10;
}
}
}
17 changes: 17 additions & 0 deletions Seminars/Seminar05/Self/Task8/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
class Program
{
static void Main()
{
int x = int.Parse(Console.ReadLine()), k = int.Parse(Console.ReadLine());
if (Math.Pow(10, k - 1) <= x) {
while (Math.Pow(10, k) <= x) {
x /= 10;
}
System.Console.WriteLine(x);
}
else {
System.Console.WriteLine("wrong input.");
}
}
}
11 changes: 11 additions & 0 deletions Seminars/Seminar05/Self/Task9/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
class Program
{
static void Main()
{
double x = double.Parse(Console.ReadLine()), y = double.Parse(Console.ReadLine());
double d = Math.Sqrt(x * x + y * y);
bool g = d <= 2 && x >= 0 && x >= y;
System.Console.WriteLine(g);
}
}