find square root
public class Solution {
public static void main(String[] args) {
Scanner ip = new Scanner(System.in);
System.out.print("Enter a number: ");
double n = ip.nextDouble();
System.out.println(sqrt(n));
ip.close();
}
public static double sqrt(double number) {
double t;
double squareRoot = number / ;
do {
t = squareRoot;
squareRoot = (t + (number / t)) / ;
} while ((t - squareRoot) != );
return squareRoot;
}
}
find square root的更多相关文章
- Codeforces 715A. Plus and Square Root[数学构造]
A. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Project Euler 80:Square root digital expansion 平方根数字展开
Square root digital expansion It is well known that if the square root of a natural number is not an ...
- Codeforces 612E - Square Root of Permutation
E. Square Root of Permutation A permutation of length n is an array containing each integer from 1 t ...
- Codeforces 715A & 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))
C. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- (Problem 57)Square root convergents
It is possible to show that the square root of two can be expressed as an infinite continued fractio ...
- Square Root
Square RootWhen the square root functional configuration is selected, a simplified CORDIC algorithm ...
- Codeforces Round #372 (Div. 1) A. Plus and Square Root 数学题
A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder i ...
- Plus and Square Root
ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ...
- CodeChef - SQRGOOD:Simplify the Square Root (求第N个含平方因子数)
Tiny Wong the chef used to be a mathematics teacher in a senior high school. At that time, he always ...
- Project Euler 57: Square root convergents
五十七.平方根收敛(Square root convergents) 二的平方根可以表示为以下这个无穷连分数: \[ \sqrt 2 =1+ \frac 1 {2+ \frac 1 {2 +\frac ...
随机推荐
- CodeForce 359C Prime Number
Prime Number CodeForces - 359C Simon has a prime number x and an array of non-negative integers a1, ...
- Mysql 常用数据类型 占用字节数 [转]
数据类型是定义列中可以存储什么数据以及该数据实际怎么存储的基本规则.Mysql的常用数据类型主要有: 串数据类型:最常用的数据类型,有两种基本的串类型:分别为定长串和不定长串.定长串结束长度固定的字符 ...
- 一小段 Dapper 的简单示例
关于 Dapper 的介绍,请参考:Dapper - 一款轻量级对象关系映射(ORM)组件,DotNet 下 using System; using System.Collections.Generi ...
- CreateDatabase is not supported by the provider
背景:对于本地数据库如(SQLite\Access) Connection string error: “An exception occurred while initializing the da ...
- centos ftp服务器搭建 vsftpd 匿名访问配置方法 ftp 550 Failed to open file 错误处理
vsftpd是linux下常用的ftp服务软件,配置起来其实不复杂,只是网上很多文章,配置后都无法成功.我使用它是用于局域网内部分享文件的,所以使用匿名的方式. ftp本身密码是明文传输的,如果需要安 ...
- 百度站长平台HTTPS认证所遇到的坑
坑1: 百度站长平台https认证失败,提示:请确保您网站的所有链接均支持https访问,且未使用不安全协议(如:SSL2.SSL3等协议). 解决办法: 1. 友情链接检查, 要检查所有的友情链接 ...
- jQuery-ready与load
// ready 在DOM加载完成时运行的代码 $(document).ready(function(){ // 在这里写代码... }) // 可以简写为 $(function(){ // 在这 ...
- 完整且易读的微信小程序的注册页面(包含倒计时验证码、获取用户信息)
目录 1.页面展示 2.wxml代码 3.wxss代码 4.js代码 1.页面展示 2.wxml代码 <!--pages/register/register.wxml--> <scr ...
- 深入Java源码剖析之Set集合
Java的集合类由Collection接口和Map接口派生,其中: List代表有序集合,元素有序且可重复 Set代表无序集合,元素无序且不可重复 Map集合存储键值对 那么本篇文章将从源码角度讨论一 ...
- Docker 网络简单说明
docker0 网络模型小结 Docker Daemon 会创建出一个名为 docker0 的虚拟网桥 ,用来连接宿主机与容器,或者连接不同的容器. veth pair 是用于不同network na ...