Answered step by step
Verified Expert Solution
Question
1 Approved Answer
following: Find the prime number between 1 to 100. Prime numbers are the numbers whose only factors are 1 and the number itself clc, clear
following: Find the prime number between 1 to 100. Prime numbers are the numbers whose only factors are 1 and the number itself clc, clear all; for- 96A loop to iterate from 1 to 100 counter-0; for num 96A loop to iterate from 'i, to 1 f (mod(inum)--0) counter counter+1; end end if (counter-2) %for prime numbers, counter should be exactly 2 %result of mod() operation is zero only when prime number is divided by 1 and %itself. All other numbers are non-prime. displl prime number- 'num2str()lD end end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started