DoubleOps.java
2024-08-29 01:03:46
/******************************************************************************
* Compilation: javac DoubleOps.java
* Execution: java DoubleOps a b
*
* Illustrates the integer operations a + b, a * b, and a / b.
*
* % java DoubleOps 1234 99
* 1234.0 + 99.0 = 1333.0
* 1234.0 * 99.0 = 122166.0
* 1234.0 / 99.0 = 12.464646464646465
* 1234.0 % 99.0 = 46.0
*
* % java DoubleOps 10 -3
* 10.0 + -3.0 = 7.0
* 10.0 * -3.0 = -30.0
* 10.0 / -3.0 = -3.3333333333333335
* 10.0 % -3.0 = 1.0
*
* % java DoubleOps Infinity 3
* Infinity + 3.0 = Infinity
* Infinity * 3.0 = Infinity
* Infinity / 3.0 = Infinity
* Infinity % 3.0 = NaN
*
******************************************************************************/ public class DoubleOps { public static void main(String[] args) {
double a = Double.parseDouble(args[0]);
double b = Double.parseDouble(args[1]);
double sum = a + b;
double prod = a * b;
double quot = a / b;
double rem = a % b; System.out.println(a + " + " + b + " = " + sum);
System.out.println(a + " * " + b + " = " + prod);
System.out.println(a + " / " + b + " = " + quot);
System.out.println(a + " % " + b + " = " + rem); System.out.println();
System.out.println("sin(pi/2) = " + Math.sin(Math.PI/2));
System.out.println("log(e) = " + Math.log(Math.E));
}
}
最新文章
- C#打开关闭数据库连接
- /proc/interrupts 统计2.6.38.8与3.10.25差异
- 【BZOJ-4590】自动刷题机 二分 + 判定
- <;meta>;标签元素的属性理解
- 【转】C#进阶系列——WebApi 接口参数不再困惑:传参详解
- MVC5+EF6简单实例---以原有SQLServer数据库两表联合查询为例
- 【Xamarin报错】AndroidManifest.xml : warning XA0101: @(Content) build action is not supported
- Linux下挂载NTFS格式的U盘或硬盘
- Could not write metadata for &#39;/taiping-sol-insu-composite&#39;.
- css中图片的四种地址引用
- 从零开始学习MySQL1---MySQL基础
- 玩转Win32开发(2):完整的开发流程
- Delphi组件开发-在窗体标题栏添加按钮(使用MakeObjectInstance(NewWndProc),并处理好多消息)
- Less和Sass的使用
- Maste Note for OCR / Vote disk Maintenance Operations (ADD/REMOVE/REPLACE/MOVE)
- vim 实用配置
- 笔记:Maven Web项目
- java编程行业微信群,无论新手老手欢迎加入,会一直更新
- bean 装配
- 712. Minimum ASCII Delete Sum for Two Strings