Calculates the volume of a cylinder, given its radius and height - C++ Data Type

C++ examples for Data Type:double

Description

Calculates the volume of a cylinder, given its radius and height

Demo Code

#include <iostream>
using namespace std;
int main()//from w ww  . j  a v  a  2s.  c o  m
{
   double radius, height, volume;
   radius = 2.5;
   height = 16.0;
   volume = 3.1416 * radius * radius * height;
   cout << "The volume of the cylinder is " << volume << endl;
   return 0;
}

Result


Related Tutorials