1: using System;
2:
3: namespace st
4: {
5: class TwoHighest
6: {
7:
8: public static void Main()
9: {
10: int fh, sh;
11: int[] a = { 10, 30, 40, 22, 55 };
12: FirstTwoHighest(a, out fh, out sh);
13: Console.WriteLine("First Highest {0}, Second Highest : {1}", fh, sh);
14: }
15:
16: public static void FirstTwoHighest(int[] a, out int fh, out int sh)
17: {
18: fh = sh = 0;
19: foreach (int n in a)
20: {
21: if (n > fh)
22: {
23: sh = fh;
24: fh = n;
25: }
26: else
27: if ( n > sh )
28: sh = n;
29:
30: } // foreach
31: } // FirstTwoHighest
32: } // class
33: } // namespace
Your blog was very interesting & easy to understand. I really appreciate your information which you shared with us. Keep in blogging & Thanks. Warehouse Audit | Fixed Assets Audit | CFA Audit
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteYour blog was very interesting & easy to understand. Thank you so much sharing that valuable blog….. AP Vendor Helpdesk
ReplyDeleteDuplicate Payment Audit
Revenue Assurance
Fraud Prevention
The Article is very usefull .... thank you for the information
ReplyDeleteStock Audit