码迷,mamicode.com
首页 > 其他好文 > 详细

HW2.2

时间:2016-08-06 14:16:17      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 1 import java.util.Scanner;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8 
 9         System.out.print("Enter the radius and length of a cylinder: ");
10 
11         double radius = input.nextDouble();
12         double length = input.nextDouble();
13 
14         double area = radius * radius * Math.PI;
15         double volume = radius * radius * Math.PI * length;
16         
17         System.out.println("The area is " + area);
18         System.out.println("The volume is " + volume);
19 
20         input.close();
21     }
22 }

 

HW2.2

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5743802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!