ColonelNV

монопоток

Dec 8th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2.  
  3. using System.Diagnostics;
  4.  
  5. namespace ConsoleApp1
  6.  
  7. {
  8.  
  9.     class ConsoleApp1
  10.  
  11.     {
  12.  
  13.         private static void Main(string[] args)
  14.  
  15.         {
  16.  
  17.             Console.WriteLine("Введите кол-во строк: ");
  18.  
  19.             int n = Convert.ToInt32(Console.ReadLine());
  20.  
  21.             Console.WriteLine("Введите кол-во столбцов: ");
  22.  
  23.             int m = Convert.ToInt32(Console.ReadLine());
  24.  
  25.             double  N = 1;
  26.  
  27.             double[,] array = new double[n + 1, m + 1];
  28.  
  29.             var timer = Stopwatch.StartNew();
  30.  
  31.             for (int i = 1; i < n + 1; i++)
  32.  
  33.             {
  34.  
  35.                 L = 0;
  36.  
  37.                 for (int j = 1; j < m + 1; j++)
  38.  
  39.                 {
  40.  
  41.                     array[i, j] = Math.Sqrt((i-1)+(j-1));
  42.  
  43.                     L += array[i, j];
  44.  
  45.                 }
  46.  
  47.                 N *= L;
  48.  
  49.             }
  50.  
  51.             Console.WriteLine("Результат - " + "{0:0.00}", N);
  52.  
  53.             timer.Stop();
  54.  
  55.             Console.WriteLine("Выполнение метода заняло {0} мс", timer.ElapsedMilliseconds);
  56.  
  57.             Console.WriteLine("Выполнение метода заняло {0} тактов", timer.ElapsedTicks);
  58.  
  59.             Console.ReadKey();
  60.  
  61.         }
  62.  
  63.     }
  64.  
  65. }
Add Comment
Please, Sign In to add comment