Advertisement
Guest User

Untitled

a guest
Dec 18th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace zweit_groesste_zahl
  4. {
  5. class Program
  6. {
  7. //check
  8. static int ztgzahl(int[] ZL)
  9. {
  10. int MinZ = Int16.MinValue;
  11. int MaxZ = Int16.MinValue;
  12. for(int i = 0; i < ZL.Length; i++)
  13. {
  14. if (ZL[i] > MaxZ)
  15. {
  16. MinZ = MaxZ;
  17. MaxZ = ZL[i];
  18. }
  19. else if (ZL[i] > MinZ)
  20. {
  21. MinZ = ZL[i];
  22. }
  23. }
  24. return MinZ;
  25. }
  26. //end
  27.  
  28. //return input back
  29. static void Zahlwg(int[] ZL)
  30. {
  31. for(int i = 0; i < ZL.Length; i++)
  32. {
  33.  
  34.  
  35. }
  36. }
  37. //end
  38.  
  39. //give the input number
  40. static int[] ZahlA(int Anzahl)
  41. {
  42. int[] ZL = new int[Anzahl];
  43. for(int i = 0; i < Anzahl; i++)
  44. {
  45. Console.Write($"\n{i + 1}.Zahl eingeben:");
  46. ZL[i] = Convert.ToInt16(Console.ReadLine());
  47.  
  48. }
  49. return ZL;
  50. }
  51. //end
  52.  
  53. //main
  54. static void Main(string[] args)
  55. {
  56. int n = 0;
  57.  
  58. int[] Ztg = new int[n];
  59. Console.Write("\nAnzahl der Zahlen eingeben:");
  60. n = Convert.ToInt16(Console.ReadLine());
  61. Ztg = ZahlA(n);
  62. Zahlwg(Ztg);
  63. Console.WriteLine($"\nDer zweitgrößte zahl von eingegeben zahlen ist {ztgzahl(Ztg)}");
  64. Console.ReadLine();
  65.  
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement