clear; clc;

x = 101;
isPrime = true; % a flag

for y = 2 : sqrt(x)
    if mod(x, y) == 0
        isPrime = false;
        break; % early termination
    end
end

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