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;
- namespace Find_Second_Big_Number
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] myArray = new int[] { 0, 1, 2, 3, 13, 8, 5 };
- int largest = int.MinValue;
- int second = int.MinValue;
- foreach (int i in myArray)
- {
- if (i > largest)
- {
- second = largest;
- largest = i;
- }
- else if (i > second)
- second = i;
- }
- Console.WriteLine(second.ToString());
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement