Advertisement
Sephinroth

prac 3 ex 6

Sep 21st, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace prac_3_ex_5
  7. {
  8.     class Program
  9.     {
  10.         static double Fun(double x, double a)
  11.         {
  12.             if (x < a) return 0;
  13.             else
  14.                 if (x == a) return 1;
  15.                 else
  16.                     return (x - a) / (x + a);
  17.         }
  18.         static void Main(string[] args)
  19.         {
  20.             Console.WriteLine("Введите a, b и h: ");
  21.             double a = double.Parse(Console.ReadLine());
  22.             double b = double.Parse(Console.ReadLine());
  23.             double h = double.Parse(Console.ReadLine());
  24.             for (double i = a; i <= b; i += h)
  25.                 Console.WriteLine("x = {0,5} \t y = {1}", i, Fun(i, a));
  26.             Console.ReadKey();
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement