can you please give me the answers
1 view (last 30 days)
Show older comments
- 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
Image Analyst
on 13 Jul 2022
Sorry, but no. Your professor wouldn't go for that. But we can help. Read this:
DGM
on 13 Jul 2022
(Maximum Marks: 50)
At least you let us know how many points it's worth. Nice touch.
Answers (1)
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
c)Update the vector prime_numbers accordingly
Read about isprime
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
Read about fprintf
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!