Download Java——eclipse/a/src/com/sxt/text.java from Beifengdo/Java-Programming: direct link, hf CLI and curl.
- Browser
- Download file 385 Bytes
-
https://huggingface.co/datasets/Beifengdo/Java-Programming/resolve/8f013bb164053706c82abfc1ebb4a3f95aab6b60/Java%E2%80%94%E2%80%94eclipse/a/src/com/sxt/text.java
- Command line
-
hf download hf://datasets/Beifengdo/Java-Programming@8f013bb164053706c82abfc1ebb4a3f95aab6b60/Java——eclipse/a/src/com/sxt/text.java
-
curl -L -o text.java https://huggingface.co/datasets/Beifengdo/Java-Programming/resolve/8f013bb164053706c82abfc1ebb4a3f95aab6b60/Java%E2%80%94%E2%80%94eclipse/a/src/com/sxt/text.java
385 Bytes
| package com.sxt; | |
| public class text { | |
| public static void main(String[] args) { | |
| int n = 20; | |
| double sum = 1.0; | |
| double term; | |
| double factorial = 1; | |
| for (int i = 1; i <= n; i++) { | |
| factorial *= i; | |
| term = 1.0 / factorial; | |
| sum += term; | |
| if (term < 0.0001) { | |
| break; | |
| } | |
| } | |
| System.out.printf("%.4f", sum, args); | |
| } | |
| } | |