1. Please, give your answers in comments – what does the function written below do:

a) recognizes prime numbers

b) recognizes prime numbers in interval [100;999]

c) neither a) nor b) is correct

d) other variant (please, specify)

2. And the second question is – is this function a correct solution if the task is as follows: `Please, write a function that recognizes all the prime numbers consisting of exactly 3 digits`:

a) yes

b) no

The function (in C++):

bool f(int x) {

for (int y=2;y<x;y++)

if (x%y==0) return false;

return true;

}

P.S. I wish all of you wrote your thoughts in order to make a student of mine understand the essence of the thing!

Advertisements