Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. //Rextester.Program.Main is the entry point for your code. Don't change it.
  2. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.RegularExpressions;
  8.  
  9. namespace Rextester
  10. {
  11.     public class Program
  12.     {
  13.         public static int tankvol(int h, int d, int vt)
  14.         {
  15.             int r = d/2;
  16.             int h2 = d - h;
  17.             double areaOfCircle = Math.PI * r * r;
  18.             double areaOfSector = r * r * Math.Acos((double)(r - h2)/r);
  19.             double areaOfTriangle = (r - h2) * Math.Sqrt(2 * r* h2 - h2 * h2);
  20.             double areaOfLiquid = areaOfCircle - areaOfSector + areaOfTriangle;
  21.             double l = vt/(Math.PI * r * r);
  22.             return (int)Math.Floor(areaOfLiquid * l);
  23.         }
  24.  
  25.         public static void Main(string[] args)
  26.         {
  27.             int a = tankvol(80,120,3500);
  28.             Console.WriteLine(a);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement