using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Laboratorna2 { class Laboratorna2 { public static void A() { Console.WriteLine("Це метод А(), що не приймає і пе повертає параметрів"); } public static void B(int n, int m) { Console.Write("Сума:"); Console.WriteLine(n + m); Console.Write("Різниця:"); Console.WriteLine(n - m); Console.Write("Добуток:"); Console.WriteLine(n * m); Console.Write("Частка:"); Console.WriteLine(Convert.ToDouble(n) / m); } public static double C(double k, double l, double m) { return (k + l + m) / 3; } public static string N11(ref int Numb) { Numb = 11 * Numb; return ""; } public static int Line(ref string line) { char[] arr = line.ToCharArray(); Array.Reverse(arr); line = new string(arr); return line.Length; } static void Main(string[] args) { Console.WriteLine(""); A(); Console.WriteLine("----------"); Console.WriteLine("Метод B:"); B(5, 7); Console.WriteLine("----------"); Console.WriteLine("Середнє арифметичне трьох чисел в методі С(): {0}", C(5.25, 15, -14.5)); Console.WriteLine("----------"); Console.WriteLine("Площа круга: {0}", Geometry.S(9)); Console.WriteLine("----------"); double P, S; Geometry.Par(7, out P, out S); Console.WriteLine("Периметр & площа круга: P={0}; S={1}", P, S); Console.WriteLine("----------"); int N = 9; Console.WriteLine("Метод N11: Число = {0}; Результат = {2}", N, N11(ref N), N); Console.WriteLine("----------"); string text = "Будь-який текст"; Console.WriteLine("Метод Text: Початкові дані= \"{0}\"; К-сть символів = {1}; Результат = \"{2}\";", text, Line(ref text), text); Console.ReadKey(); } } } class Geometry { public static double S(double R) { return Math.PI * Math.Pow(R, 2); } public static void Par(double R, out double S, out double P) { S = Math.PI * Math.Pow(R, 2); P = 2 * Math.PI * R; } }