Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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 srednia
  8. {
  9. class Program
  10. {
  11.  
  12. static void Main(string[] args)
  13. {
  14. double a, b, c,g;
  15.  
  16. Console.Write("Podaj pierwsza liczbe: ");
  17. a = Convert.ToDouble(Console.ReadLine());
  18. Console.WriteLine("Podaj druga liczbe: ");
  19. b = Convert.ToDouble(Console.ReadLine());
  20. if ((c < 0) || (g < 0))
  21. {
  22. Console.WriteLine("Błędne dane");
  23. Console.ReadKey();
  24.  
  25. }
  26.  
  27. else
  28. {
  29.  
  30. c = (a + b) /2;
  31. g = Math.Sqrt (a * b);
  32. Console.WriteLine("Średnia arytmetyczna wynoi: {0} ", c);
  33. Console.WriteLine("Srednia geometryczna wynosi: {0} ", g);
  34. Console.ReadKey();
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement