clear; clc;

x = 2018;
isPrime = true; % flag

for y = 2 : x - 1
    if mod(x, y) == 0
        isPrime = false;
        break;
    end
end

if isPrime 
    disp('Is a prime.');
else
    disp('Not a prime.');
end