7 kyu

Volume of a cup

664 of 1,214tdowek1

Description:

Your job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height.

You know that there is a steady gradient from the top to the bottom.

You want to return the volume rounded to 2 decimal places.

Exmples:

cup_volume(1, 1, 1)==0.79

cup_volume(10, 8, 10)==638.79

cup_volume(1000, 1000, 1000)==785398163.4

cup_volume(13.123, 123.12, 1)==4436.57

cup_volume(5, 12, 31)==1858.51
cup_volume(1, 1, 1)==0.79

cup_volume(10, 8, 10)==638.79

cup_volume(1000, 1000, 1000)==785398163.4

cup_volume(13.123, 123.12, 1)==4436.57

cup_volume(5, 12, 31)==1858.51
cupVolume(1, 1, 1);
//returns 0.79

cupVolume(10, 8, 10);
//returns 638.79

cupVolume(1000, 1000, 1000);
//returns 785398163.4

cupVolume(13.123, 123.12, 1);
//returns 4436.57

cupVolume(5, 12, 31);
//returns 1858.51
cupVolume(1, 1, 1)
# returns 0.79

cupVolume(10, 8, 10)
# returns 638.79

cupVolume(1000, 1000, 1000)
# returns 785398163.4

cupVolume(13.123, 123.12, 1)
# returns 4436.57

cupVolume(5, 12, 31)
# returns 1858.51

You will only be passed positive numbers.

Geometry
Fundamentals

Stats:

CreatedJan 21, 2016
PublishedJan 22, 2016
Warriors Trained2603
Total Skips104
Total Code Submissions3301
Total Times Completed1214
JavaScript Completions490
CoffeeScript Completions15
Ruby Completions102
Python Completions664
Total Stars43
% of votes with a positive feedback rating83% of 198
Total "Very Satisfied" Votes144
Total "Somewhat Satisfied" Votes39
Total "Not Satisfied" Votes15
Ad
Contributors
  • tdowek1 Avatar
  • GiacomoSorbi Avatar
  • hilary Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
Ad