MATLAB: How to determine if a number is prime

homeworkloopsnumberprime

Hello, I was wondering if you can help how to determine if numbers from 0 to 100 are prime. Should I use loops? Please I am really confused with this homework.

Best Answer

thats not difficult .try to solve it on paper first .for example u have a number 100 . how will u check that its prime or not ?
divide it with all numbers from 1 to 99 .. and if any time the remainder is zero its not a prime number
to divide 100 from 1 to 100 u can use for loop .