Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rextester.Program.Main is the entry point for your code. Don't change it.
- //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace Rextester
- {
- public class Program
- {
- public static int tankvol(int h, int d, int vt)
- {
- int r = d/2;
- int h2 = d - h;
- double areaOfCircle = Math.PI * r * r;
- double areaOfSector = r * r * Math.Acos((double)(r - h2)/r);
- double areaOfTriangle = (r - h2) * Math.Sqrt(2 * r* h2 - h2 * h2);
- double areaOfLiquid = areaOfCircle - areaOfSector + areaOfTriangle;
- double l = vt/(Math.PI * r * r);
- return (int)Math.Floor(areaOfLiquid * l);
- }
- public static void Main(string[] args)
- {
- int a = tankvol(80,120,3500);
- Console.WriteLine(a);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement