Advertisement
AIwinter

задача ооп

Nov 11th, 2022
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4.  
  5. namespace ConsoleApp4
  6. {
  7. internal class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Console.WriteLine("\n 1) Array: ");
  12. var FavoriteFood = new string[] { "Apple", "Cake", "Pizza", "Salad" };
  13.  
  14. //поиск наиб числа среди целых чисел в arraylist
  15.  
  16. Console.WriteLine("\n 2) ArrayList: ");
  17. ArrayList pos = new() { 1, 2, 3 };
  18.  
  19. pos.AddRange(FavoriteFood);
  20. pos.Remove("Apple");
  21. pos.Remove("Salad");
  22.  
  23. int[] ar = (int[])pos.ToArray(typeof(int));
  24.  
  25. int max1 = ar.Max();
  26.  
  27. Console.WriteLine(max1);
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement