Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public static Summer (Stack <int> S1, Stack <int> S2)
- {
- int count, sum1 = 0; sum2 = 0, a,b,c,d;
- bool flag;
- Stack <int> temp = new Stack <int>();'
- While (S1.IsEmpty() && flag == true)
- {
- flag = true;
- a = S1.Pop();
- b = S1.Top();'
- sum1 = a + b;
- While (!S2.IsEmpty())
- {
- c = S2.Pop();
- d = s2.Top();
- sum2 = c+d;
- if ( sum2 > sum1)
- flag = false;
- temp.Push(C);
- }
- While (!temp.IsEmpty())
- S2.Push(temp.Pop());
- if (flag)
- return sum1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement