-->
当前位置:首页 > 题库

PROGRAMMING:Output n prime numbers greater than x

Luz5年前 (2021-05-10)题库337
The user inputs an integer x and outputs n primes greater than x.
###Input format:
An integer x and a positive integer n, X is not greater than 800, n is not greater than 50.
###Output format:
Output n primes greater than x, every 5 primes occupy a row, the values are separated by spaces, and there is no space after the last prime.
###Input example:
```in
6 3
```
###Output example:
```out
7 11 13
```







answer:If there is no answer, please comment
The trick of this problem is that the outer loop I starts from x + 1. If I is a prime number, output, and add 1 to the counter. When the counter reaches n, stop output. Because every five prime numbers occupy one line, it is necessary to find the remainder of 5 in the counter. When it can be divided by 5, add a carriage return.