Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. namespace ConsoleApplication4
  2. {
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. List<int> myList = new List<int>();
  8.  
  9.  
  10.  
  11. for (int i = 0; i < 20; i++)
  12. {
  13. Console.WriteLine("Skriv in 20 heltal");
  14. myList.Add(int.Parse(Console.ReadLine())); // HÄR
  15. }
  16.  
  17. int max = myList[0];
  18. foreach (int heltal in myList)
  19. {
  20.  
  21. if (max < heltal)
  22. {
  23. max = heltal;
  24. }
  25.  
  26. }
  27.  
  28.  
  29. Console.WriteLine("\n" + "Det största talet du skrivit in är: " + max.ToString());
  30.  
  31. Console.ReadLine();
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement