Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace Rextester
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- double[] a = new double[30];
- int [] b = new int[30];
- double[] c = new double[30];
- int i, n1, n2, n3;
- double x;
- Console.Write("vvedite n1:");
- Console.WriteLine();
- n1 = int.Parse(Console.ReadLine());
- Console.Write("vvedite n2:");
- n2 = int.Parse(Console.ReadLine());
- Console.Write("vvedite n3:");
- n3 = int.Parse(Console.ReadLine());
- Console.WriteLine();
- if (( n1 == n2)&&(n1 == n3)) {
- Console.Write("nuzhno vvesti raznie n"); return; }
- Random rand = new Random();
- for (i=0; i< n1; i++)
- {
- b[i] = rand.Next(-15, 15);
- Console.Write("b[" + i + "]= " + b[i].ToString());
- Console.WriteLine();
- }
- Console.WriteLine();
- for (i=0; i<n2; i++)
- {
- try
- {
- for (x = - 2; x <=4; x= x + 0.3)
- {
- a[i] = Math.Log(1/(x+1));
- }
- catch(IndexOutOfRangeException)
- {
- a[i] =0;
- }
- catch(DivideByZeroException)
- {
- a[i] =0;
- }
- Console.Write("a[" + i + "]= " + a[i].ToString());
- Console.WriteLine();
- }
- Console.WriteLine();
- for( i=0; i<n3; i++)
- {
- try
- {
- c[i] = a[i]/b[i+1];
- }
- catch(IndexOutOfRangeException)
- {
- c[i] =0;
- }
- catch(DivideByZeroException)
- {
- c[i] =0;
- }
- Console.Write("c[" + i + "]= " + c[i].ToString());
- Console.WriteLine();
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement