Prime Numbers

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', n)
else
fprintf('%d is composite\n', 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', 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

Author:
Category :
Publish Date :
Social Sharing