Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 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 ConsoleApplication3
  8. {
  9. class Program
  10. {
  11. public static double Minimum(params double[] tab)
  12. {
  13. double minimum = tab[0];
  14. for (int i = 0; i < tab.Length; i++)
  15. {
  16. if (minimum > tab[i])
  17. {
  18. minimum = tab[i];
  19. }
  20. }
  21. return minimum;
  22. }
  23. static void Main(string[] args)
  24. {
  25. Console.WriteLine("Podaj 5 liczb");
  26. double a, b, c, d, e;
  27. a = Convert.ToDouble(Console.ReadLine());
  28. b = Convert.ToDouble(Console.ReadLine());
  29. c = Convert.ToDouble(Console.ReadLine());
  30. d = Convert.ToDouble(Console.ReadLine());
  31. e = Convert.ToDouble(Console.ReadLine());
  32. Console.WriteLine("Minimum z liczb " +a+ " , " + b + " , " + c + " , " + d + " , " + e+ " to: " + Minimum(a,b,c,d,e) );
  33. Console.WriteLine("Minimum z liczb(2,3 2,9 104 22,4) to:"+ Minimum(2.3,2.9,104,22.4));
  34. Console.WriteLine("Minimum z liczb (10 2 3 4 9) to: " + Minimum(10,2,3,4,9));
  35. Console.ReadKey();
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement