2075. 2.2 Computing the volume of a cylinder
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas:
area = radius * radius * PI
volume = area * length
PI = 3.14159
Input
One line contains num1, num2 (both in double) represent the radius and length of a cyliner.
Output
The volume in one line.
Sample Input
1 2
Sample Output
6.28318
Hint
use the following code for output:
cout << answer<< endl;
Problem Source
Liu Xiaoming
#include <iostream>
#include <stdio.h>
using namespace std;
int main () {
double num1, num2;
cin>>num1>>num2;
double volume = num1 * num1 *3.14159 * num2;
cout<<volume<<endl;
//system("pause");
return 0;
}