Bob103

C#_Biggest_module

Jan 27th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main()
  4.         {
  5.             Console.Write("Enter size:");
  6.             int[] num = new int[int.Parse(Console.ReadLine())];
  7.             int max = 0;
  8.  
  9.             for (int i = 0; i < num.Length; i++)
  10.             {
  11.                 num[i] = Math.Abs(int.Parse(Console.ReadLine()));
  12.             }
  13.  
  14.             foreach ( int i in num)
  15.             {
  16.                 max = max < i ? i : max;
  17.             }
  18.  
  19.             Console.WriteLine("The biggest module =" + max);
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment