Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
顯示
檢視
拆分
統一
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
比對精度
智能
語法
無
變更外觀
處理
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
java_code
建立於
6 年前
差異永不過期
清除
匯出
分享
解釋
40 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
22 行
全部複製
29 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
23 行
全部複製
複製
已複製
複製
已複製
import java.util.*;
import java.util.*;
public class Main
{
public class Main
public static void main(String[] args)
{
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
Scanner sc = new Scanner(System.in);
System.out.println("Input the radius of coin");
System.out.println("Input the radius of coin");
double rad = sc.nextDouble();
double rad = sc.nextDouble();
複製
已複製
複製
已複製
System.out.println("Input the thickness of coin");
double thick = sc.nextDouble();
複製
已複製
複製
已複製
System.out.println("Input the target distance of coin");
System.out.println("Input the target distance of coin");
double dist = sc.nextDouble();
double dist = sc.nextDouble();
double no_of_blocks
= 0;
double length
= 2 *
rad;
double no_of_blocks
=0.0;
double length
=2*
rad;
double curr_length=0.0;
double curr_length=0.0;
double n=1
;
double n=1
.0;
while(curr_length
<
dist)
{
while(curr_length
<
dist)
{
no_of_blocks+
=1;
no_of_blocks+
+;
curr_length = curr_length + (length*(1/(2*n)));
curr_length = curr_length + (length*(1/(2*n)));
n+=1;
n++;
}
}
System.out.print
ln("Number
of blocks required are
: " +
no_of_blocks);
System.out.print
f("NO
of blocks required are
%d" , (int)
no_of_blocks);
}
}
}
}
已保存差異
原始文本
開啟檔案
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Input the radius of coin"); double rad = sc.nextDouble(); System.out.println("Input the thickness of coin"); double thick = sc.nextDouble(); System.out.println("Input the target distance of coin"); double dist = sc.nextDouble(); double no_of_blocks = 0; double length = 2 * rad; double curr_length=0.0; double n=1; while(curr_length < dist) { no_of_blocks+=1; curr_length = curr_length + (length*(1/(2*n))); n+=1; } System.out.println("Number of blocks required are: " + no_of_blocks); } }
更改後文本
開啟檔案
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Input the radius of coin"); double rad = sc.nextDouble(); System.out.println("Input the target distance of coin"); double dist = sc.nextDouble(); double no_of_blocks=0.0; double length=2*rad; double curr_length=0.0; double n=1.0; while(curr_length<dist){ no_of_blocks++; curr_length = curr_length + (length*(1/(2*n))); n++; } System.out.printf("NO of blocks required are %d" , (int)no_of_blocks); } }
尋找差異