Advertisement
Guest User

erfj

a guest
Jul 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Largest_Elemnt_In_Array
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int counter = int.Parse(Console.ReadLine());
  14.  
  15. int[] arr = new int [counter];
  16.  
  17. for (int i = 0; i < arr.Length; i++)
  18. {
  19.  
  20. arr[i] += int.Parse( Console.ReadLine());
  21.  
  22. }
  23. Console.WriteLine(FindLargestNumber(arr));
  24.  
  25. }
  26.  
  27. static int FindLargestNumber(int[] inputArray)
  28. {
  29. int check = int.MinValue;
  30.  
  31. for (int i = 0; i < inputArray.Length; i++)
  32. {
  33. if (inputArray[i] > check)
  34. {
  35. check = inputArray[i];
  36. }
  37. }
  38. return check;
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement