Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. namespace Ostroslup
  2. {
  3. class Program
  4. {
  5. public static void ObjetoscPiramidy(double podstawa, double krawedz)
  6. {
  7. if (podstawa < 0 || krawedz < 0)
  8. {
  9. Console.WriteLine("ujemne wartości parametrów");
  10. }
  11. else if (podstawa == 0)
  12. {
  13. Console.WriteLine("nie spełniony warunek trójkąta");
  14. }
  15. else
  16. {
  17. double score = podstawa * podstawa * Math.Sqrt(krawedz * krawedz - (podstawa * podstawa) / 2) / 3;
  18. Console.WriteLine(score);
  19. }
  20. }
  21.  
  22. static void Main(string[] args)
  23. {
  24. ObjetoscPiramidy(4, 4);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement