Python
```python
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n0.5) + 1):
if n % i == 0:
return False
return True
start = int(input("请输入开始的整数值:"))
end = int(input("请输入结束的整数值:"))
for n in range(start, end + 1):
if is_prime(n):
print(n, "是质数")
```
Java
```java
import java.util.ArrayList;
import java.util.List;
public class PrimeNumber {
public static void main(String[] args) {
int limit = 100; // 输出100以内的质数
System.out.println("质数列表:");
for (int i = 2; i <= limit; i++) {
if (isPrime(i)) {
System.out.print(i + " ");
}
}
}
public static boolean isPrime(int number) {
if (number <= 1) {
return false;
}
for (int i = 2; i <= Math.sqrt(number); i++) {
if (number % i == 0) {
return false;
}
}
return true;
}
}
```
C++
```cpp
include include include bool isPrime(int n) { if (n <= 1) { return false; } for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } int main() { int limit = 100; // 输出100以内的质数 std::cout << "质数列表:" << std::endl; for (int i = 2; i <= limit; i++) { if (isPrime(i)) { std::cout<< i << " "; } } return 0; } ``` JavaScript ```javascript function isPrime(n) { if (n <= 1) { return false; } for (let i = 2; i <= Math.sqrt(n); i++) { if (n % i === 0) { return false; } } return true; } const start = parseInt(prompt("请输入开始的整数值:")); const end = parseInt(prompt("请输入结束的整数值:")); for (let n = start; n <= end; n++) { if (isPrime(n)) { console.log(n + " 是质数"); } } ``` 这些代码示例分别用 Python、Java、C++ 和 JavaScript 编写,用于输出指定范围内的所有质数。你可以根据需要选择合适的编程语言和修改输入输出的范围。