Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MainClass
- {
- static double f(double x)
- {
- try
- {
- if (4-x*x <1) throw new Exception();
- else return Math.Log(4-x*x);
- }
- catch
- {
- throw;
- }
- }
- public static void Main ()
- {
- try
- {
- Console.Write("a=");
- double a = double.Parse(Console.ReadLine());
- Console.Write("b=");
- double b = double.Parse(Console.ReadLine());
- Console.Write("h=");
- double h = double.Parse(Console.ReadLine());
- for (double i = a; i <= b; i += h)
- try
- {
- Console.WriteLine("y({0})={1:f4}", i, f(i));
- }
- catch
- {
- Console.WriteLine("y({0})=error", i);
- }
- }
- catch (FormatException)
- {
- Console.WriteLine("Неверный формат ввода данных");
- }
- catch
- {
- Console.WriteLine("Неизвестная ошибка");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement