Advertisement
mess0011

ue5_6

Nov 15th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication88
  8. {
  9.     class Program
  10.     {
  11.         public static int myf(int zahl1, int zahl2, params int[] liste)
  12.         {
  13.             int maxi = 0;
  14.             int mini = 999;
  15.             for (int i = 1; i < liste.Length ; i++)
  16.             {
  17.                 if (liste[i] > maxi)
  18.                 {
  19.                     maxi = liste[i];
  20.                 }
  21.                 else if (liste[i] < mini)
  22.                 {
  23.                     mini = liste[i];
  24.                 }
  25.             }
  26.             zahl1 = maxi;
  27.             mini = zahl2;
  28.             return mini;
  29.         }
  30.         static void Main()
  31.         {
  32.             int[] liste = { 25, 2, 12, 7, 3, 88, 9 };
  33.             int erg1;
  34.             int zahl2 = 2;
  35.             erg1 = myf(1, zahl2, liste);
  36.             Console.WriteLine("Zahl {0}", erg1);
  37.             Console.WriteLine("Zahl {0}", zahl2);
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement