Anonim_999

2.1

Dec 22nd, 2022 (edited)
1,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp27
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Введите длины сторон треугольника: ");
  10.             string aInput = Console.ReadLine();
  11.             string bInput = Console.ReadLine();
  12.             string cInput = Console.ReadLine();
  13.             int a, b, c;
  14.            
  15.             if (int.TryParse(aInput,out a)
  16.                 && int.TryParse(bInput, out b)
  17.                 && int.TryParse(cInput, out c))
  18.                 Perimeter(a,b,c);
  19.             else
  20.                 Console.WriteLine("Ошибка ввода!");
  21.         }
  22.  
  23.         private static void Perimeter(int a, int b, int c)
  24.         {
  25.             int perimeter = a + b + c;
  26.             Console.WriteLine($"Периметр: {perimeter}");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment