fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int[] Zahlen = new int[5]{3,2,1,4,5};
  8. int Index = 0;
  9. int minWert = Zahlen[0];
  10. while (Index < 5)
  11. {
  12. if (Zahlen[Index] < minWert)
  13. {
  14. minWert = Zahlen[Index];
  15. }
  16. Index = Index + 1;
  17. }
  18.  
  19. Index = 0;
  20. int maxWert = Zahlen[0];
  21. while (Index < 5)
  22. {
  23. if (Zahlen[Index] > maxWert)
  24. {
  25. maxWert = Zahlen[Index];
  26. }
  27. Index = Index + 1;
  28. }
  29.  
  30. Console.WriteLine("Minimalwert: {0}", minWert);
  31. Console.WriteLine("Maximalwert: {0}", maxWert);
  32. }
  33. }
Success #stdin #stdout 0.01s 131776KB
stdin
Standard input is empty
stdout
Minimalwert: 1
Maximalwert: 5