can you please give me the answers

2 views (last 30 days)
ABHIJITH
ABHIJITH on 13 Jul 2022
Commented: ABHIJITH on 14 Jul 2022
  1. Define a variable continue_flag to use in the while loop: (Maximum Marks: 50)
a)Also, create an empty vector called prime_numbers
b)In the while loop, prompt the user for an integer input and determine whether it is a prime number of not
c)Update the vector prime_numbers accordingly
d)Also, prompt the user to continue or terminate the session
e)Write the prime_numbers to an output file called prime_numbers_output.txt or a file of choice
  2 Comments
DGM
DGM on 13 Jul 2022
(Maximum Marks: 50)
At least you let us know how many points it's worth. Nice touch.

Sign in to comment.

Answers (1)

KSSV
KSSV on 13 Jul 2022
a)Also, create an empty vector called prime_numbers
Read about initializng the arrays. Hint: zeros, ones
b)In the while loop, prompt the user for an integer input and determine whether it is a prime number of not
Read about the function input, isprime
c)Update the vector prime_numbers accordingly
Read about isprime
d)Also, prompt the user to continue or terminate the session
Read about break,
e)Write the prime_numbers to an output file called prime_numbers_output.txt or a file of choice
Read about fprintf

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!