Code: clc; clear; disp('Prime Number List 1 to 100'); for i=2:100 for j=2:100 if(~mod(i,j)) break; % if factor found, not prime end end if(j > (i/j)) fprintf('%d is prime\n', i); end end Output:
You write simple and easy program to understand for loop Maltab. Keep posting new stuffs... thanks
ReplyDeleteThis really works👍
ReplyDeleteLogic
ReplyDelete