diff --git a/exam/exercise 11/Program.cs b/exam/exercise 11/Program.cs new file mode 100644 index 0000000..8fed199 --- /dev/null +++ b/exam/exercise 11/Program.cs @@ -0,0 +1,34 @@ +using System; + +namespace exercise_11 +{ + public class Program + { + public static int Summa(int a, int b, int c) + { + return a + b + c; + } + + public static void Main() + { + int[] Massiv = new int[10]; + Massiv[0] = 4; + Massiv[1] = 2; + Massiv[2] = 7; + + for (int i = 3; i < 10; i++) + { + Massiv[i] = Summa(Massiv[i - 3], Massiv[i - 2], Massiv[i - 1]); + } + + Console.Write("Первые 10 элементов ряда: "); + + foreach (int j in Massiv) + { + Console.Write($"{j} "); + } + + Console.ReadLine(); + } + } +} diff --git a/exam/exercise 11/exercise 11.csproj b/exam/exercise 11/exercise 11.csproj new file mode 100644 index 0000000..cbacc5c --- /dev/null +++ b/exam/exercise 11/exercise 11.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + exercise_11 + + + diff --git a/exam/exercise 14/Car.cs b/exam/exercise 14/Car.cs new file mode 100644 index 0000000..ac9e390 --- /dev/null +++ b/exam/exercise 14/Car.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace exercise_14 +{ + class Car + { + public string start() + { + return $"Машина стартует"; + } + + public string stop() + { + return $"Машина останавливается"; + } + + public int drive(int howlong) + { + return howlong * 60; + } + } +} diff --git a/exam/exercise 14/Program.cs b/exam/exercise 14/Program.cs new file mode 100644 index 0000000..fba76e0 --- /dev/null +++ b/exam/exercise 14/Program.cs @@ -0,0 +1,17 @@ +using System; + +namespace exercise_14 +{ + class Program + { + static void Main() + { + Car car = new Car(); + double howlong = 200; + Console.WriteLine(car.start()); + Console.WriteLine($"За время равное {howlong} минутам, расстроение пройденное машиной будет равно {car.drive(200)}"); + Console.WriteLine(car.stop()); + Console.ReadKey(); + } + } +} diff --git a/exam/exercise 14/exercise 14.csproj b/exam/exercise 14/exercise 14.csproj new file mode 100644 index 0000000..a4891d1 --- /dev/null +++ b/exam/exercise 14/exercise 14.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + exercise_14 + + + diff --git a/exam/exercise 16/LengthConverter.cs b/exam/exercise 16/LengthConverter.cs new file mode 100644 index 0000000..bbd747e --- /dev/null +++ b/exam/exercise 16/LengthConverter.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace exercise_16 +{ + class LengthConverter + { + public double ConvertMilesToKm(double length) + { + return length * 1.609; + } + public double ConvertKmToMiles(double length) + { + return length / 1.609; + } + } +} diff --git a/exam/exercise 16/Program.cs b/exam/exercise 16/Program.cs new file mode 100644 index 0000000..3f9149f --- /dev/null +++ b/exam/exercise 16/Program.cs @@ -0,0 +1,20 @@ +using System; + +namespace exercise_16 +{ + class Program + { + public static void Main() + { + LengthConverter converter = new LengthConverter(); + double length; + Console.Write("Введите длину: "); + length = Convert.ToDouble(Console.ReadLine()); + + Console.WriteLine($"Перевести {length} милей в километры: {converter.ConvertMilesToKm(length)}"); + Console.WriteLine($"Перевести {length} километров в мили: {converter.ConvertKmToMiles(length)}"); + + Console.ReadLine(); + } + } +} diff --git a/exam/exercise 16/exercise 16.csproj b/exam/exercise 16/exercise 16.csproj new file mode 100644 index 0000000..0dd3fa2 --- /dev/null +++ b/exam/exercise 16/exercise 16.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + exercise_16 + + +