Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> myList = new List<int>();
- for (int i = 0; i < 20; i++)
- {
- Console.WriteLine("Skriv in 20 heltal");
- myList.Add(int.Parse(Console.ReadLine())); // HÄR
- }
- int max = myList[0];
- foreach (int heltal in myList)
- {
- if (max < heltal)
- {
- max = heltal;
- }
- }
- Console.WriteLine("\n" + "Det största talet du skrivit in är: " + max.ToString());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement