Advertisement
dhows

48 zadacha

Dec 13th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _48_zadacha
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Enter x: ");
  14.             double x = double.Parse(Console.ReadLine());
  15.  
  16.             //a pod tochka
  17.             Console.WriteLine("A pod tochka:");
  18.             if (x <= 0)
  19.             {
  20.                 Console.WriteLine("y= " + xIsNegative(x));
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine("y= " + xIsPositive(x));
  25.             }
  26.         }
  27.  
  28.         private static double xIsNegative(double x)
  29.         {
  30.             return 5 * x + 1;
  31.         }
  32.  
  33.         private static double xIsPositive(double x)
  34.         {
  35.             return 1 - x;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement