斯坦福大学开放课程——编程方法 作业2 - 4
来源:互联网 发布:韩国dsp娱乐公司知乎 编辑:程序博客网 时间:2024/05/05 07:12
4.
In high-school geometry, you learned the Pythagorean theorem for the relationship of the lengths of the three sides of a right triangle: a2 + b2 = c2 which can alternatively be written as: c = sqrt(a2 + b2 ) .
Most of this expression contains simple operators covered in Chapter 3. The one piece that’s missing is taking square roots, which you can do by calling the standard function Math.sqrt. For example, the statement
double y = Math.sqrt(x);
sets y to the square root of x.
Write a ConsoleProgram that accepts values for a and b as ints and then calculates the solution of c as a double. Your program should be able to duplicate the following sample run:
呵呵,这题很简单,相信大家都知道如何处理,直接附上源代码
程序源代码:
- 斯坦福大学开放课程——编程方法 作业2 - 4
- 斯坦福大学开放课程——编程方法 作业2 - 2
- 斯坦福大学开放课程——编程方法 作业1-4
- 斯坦福大学开放课程——编程方法 作业1-2
- 斯坦福大学开放课程——编程方法 作业2 - 1
- 斯坦福大学开放课程——编程方法 作业2 - 3
- 斯坦福大学开放课程——编程方法 作业2 - 5
- 斯坦福大学开放课程——编程方法 作业2 - 6
- 斯坦福大学开放课程——编程方法 作业1-1
- 斯坦福大学开放课程——编程方法 作业1-3
- 斯坦福大学开放课程——编程方法 作业3
- 斯坦福大学开放课程——编程方法 作业5
- 斯坦福大学开放课程——编程方法 作业6
- 斯坦福大学开放课程——编程方法 作业7
- 斯坦福大学开放课程——编程方法 作业1-2,个人实现方法。
- 斯坦福大学开放课程——编程方法 作业4 Part I
- 斯坦福大学开放课程——编程方法 作业4 完整代码
- 斯坦福大学开放课程——编程方法 1-4
- 哈哈
- 为什么View中的getWidth()和getHeight()值为0
- 深奥的dialog
- 解析标签
- 我的大学这样上
- 斯坦福大学开放课程——编程方法 作业2 - 4
- Linux实用命令收集(待续)
- Atmega32模数转换模块的简单应用
- vmware中安装ubuntu后vmware tools的安装
- 在windows下编译FFMPEG-最新2009版本
- td内的文本或控件不换行
- 更新指定文件内容
- scons
- Flex的通信方式(二)——Webservice-2