Sephinroth

prac 5 ex 1

Oct 7th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace prac_5_ex_1
  7. {
  8.     class Program
  9.     {
  10.         static double max(double a, double b)
  11.         {
  12.             if (a > b) return a;
  13.             else return b;
  14.         }
  15.         static void Main(string[] args)
  16.         {
  17.             Console.Write("Введите x: ");
  18.             double x = double.Parse(Console.ReadLine());
  19.             Console.Write("Введите y: ");
  20.             double y = double.Parse(Console.ReadLine());
  21.             Console.WriteLine("z = {0}", max(x, 2*y-x) + max(5*x+3*y, y));
  22.             Console.ReadKey();
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment