# Prime Numbers-Writing a Function to Find Prime Numbers | Matlab

Problem Statement: To check that given integer is prime numbers or not. n>1

n= input('Enter an integer >1: ');

divisor= 2;
while ( rem(n,divisor)~=0 )
divisor= divisor + 1;
end
if (divisor==n)
fprintf('%d is prime ', n)
else
fprintf('%d is composite ', n)
end

## Problem Statement: Print the list of all prime number between a given range

a= input('Enter a positive integer: ');
b= input('Enter an integer greater than the previous value: ');

for n= a:b

% Determine whether n is prime
divisor= 2;
while ( mod(n,divisor)~=0 )
divisor= divisor + 1;
end
if (divisor==n)
fprintf('%d is prime ', n)
end

end

### Other Problem Statements:

• Find the sum of prime numbers in given range
• To find out prime factorization of given numbers
• Cryptography related problems

If you need MATLAB releted help,visit  https://www.essaycorp.com/matlab-assignment-help  to get experts’ assistance.

You can also Read This:   MATLAB Assignment Samples – Find The Average Value

MATLAB assignment help, Matlab assignment help, MATLAB assignment,