6 kyu
Tank Truck
1,285 of 4,961g964
Description:
To introduce the problem think to my neighbor who drives a tanker truck. The level indicator is down and he is worried because he does not know if he will be able to make deliveries. We put the truck on a horizontal ground and measured the height of the liquid in the tank.
Fortunately the tank is a perfect cylinder and the vertical walls on each end are flat.
The height of the remaining liquid is h
, the diameter of the cylinder base is d
,
the total volume is vt
(h, d, vt are positive or null integers).
You can assume that h
<= d
.
Could you calculate the remaining volume of the liquid?
Your function tankvol(h, d, vt)
returns an integer which is the truncated result (e.g floor)
of your float calculation.
Examples:
tankvol(40,120,3500) should return 1021 (calculation gives about: 1021.26992027)
tankvol(60,120,3500) should return 1750
tankvol(80,120,3500) should return 2478 (calculation gives about: 2478.73007973)
Tank vertical section:
Mathematics
Geometry
Similar Kata:
Stats:
Created | Sep 12, 2015 |
Published | Sep 12, 2015 |
Warriors Trained | 25361 |
Total Skips | 7107 |
Total Code Submissions | 26250 |
Total Times Completed | 4961 |
Ruby Completions | 89 |
Python Completions | 1285 |
JavaScript Completions | 959 |
CoffeeScript Completions | 14 |
Haskell Completions | 68 |
C# Completions | 279 |
Java Completions | 536 |
Clojure Completions | 30 |
C++ Completions | 510 |
PHP Completions | 153 |
Crystal Completions | 8 |
F# Completions | 32 |
C Completions | 348 |
TypeScript Completions | 112 |
Rust Completions | 192 |
Swift Completions | 119 |
Go Completions | 100 |
R Completions | 56 |
Shell Completions | 21 |
OCaml Completions | 19 |
Kotlin Completions | 106 |
Fortran Completions | 24 |
Elixir Completions | 33 |
Julia Completions | 26 |
Scala Completions | 39 |
PowerShell Completions | 22 |
Nim Completions | 12 |
Reason Completions | 3 |
Racket Completions | 20 |
Forth Completions | 12 |
Lua Completions | 39 |
Pascal Completions | 11 |
Perl Completions | 11 |
Haxe Completions | 7 |
Elm Completions | 4 |
D Completions | 7 |
COBOL Completions | 3 |
Erlang Completions | 5 |
Prolog Completions | 9 |
Total Stars | 516 |
% of votes with a positive feedback rating | 83% of 863 |
Total "Very Satisfied" Votes | 629 |
Total "Somewhat Satisfied" Votes | 169 |
Total "Not Satisfied" Votes | 65 |