A prime number is a whole number that is not evenly divisible by any other whole
ID: 3694882 • Letter: A
Question
A prime number is a whole number that is not evenly divisible by any other whole number besides 1 and itself. By definition, 1 is nota prime number. MATLAB's isprimefunction returns 1 (true) when its argument is a prime number and 0 (false) when its argument is not a prime number.Write a function that gets from the user a number and then reports the sum of all prime numbers less than or equal to that number using the format shown in the following example. For example, if the user enters the number 20, your program should report the following:The sum of all prime numbers up to 20 is 77.since 2+3+5+7+11+13+17+19 = 77. Your code must use a loopstructure.
Explanation / Answer
prime_fun.m
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.