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>
using namespace std;
#define PI 3.14159
int main(){
double radius,length;
cin>>radius>>length;
double volume;
volume=PI*radius*radius*length;
cout<<volume<<endl;
return 0;
}