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 interfaces
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rand = new Random();
- Stack<int> numbers = new Stack<int>();
- for (int i = 0; i < 100; i++)
- {
- numbers.Push(rand.Next(100));
- }
- // Where x (can be named any) greater than 50, it sums them together
- Console.WriteLine(numbers.Where(x => x > 50).Sum());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement