Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me with this Matlab code. It has some error and i dont know why it can not run. thank you so much 1.

please help me with this Matlab code. It has some error and i dont know why it can not run.
thank you so much
image text in transcribed
image text in transcribed
1. [25 Points] Develop an algorithm for adding all prime numbers between 0 and a given number. Recall that a prime number is an integer larger than 1 and which is divisible only by itself and by 1. Algorithm. m secant. m secant1. mx nonlinearsystems. mx no 1- n = input ("Enter a number:"); 2- total = 0; 3- D for number = 2:n isPrime = true; for i = 2:number-1 if mod (number, 1) = 0 isPrime = false; break; end end if is Prime total += number end end 16 - printf ("Sum of the Prime Numbers = %d", total); Command Window Unrecognized function or variable "total'. Error in Algorithe line 12) >> Algorithm Enter a number 14 Unrecognized function of variable total. Korin Algorithe line 12) fx >>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions