Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

All parts are related with each other. Please answer all of them in C or C++ language Write a function named prime() that determine whether

image text in transcribed

All parts are related with each other. Please answer all of them in C or C++ language

Write a function named prime() that determine whether or not a given number n (greater than one) is prime. The algorithm: Write a program that: If n is even then n is not a prime number except n = 2. For all odd numbers less or equal to the squareroot of n, if any of them divide n, then n is not prime Asks the user to enter an integer Saves the entry as var Calls the function prime() on the entry Displays whether or not the entry is prime 5. Write a function named eratos() that find all the prime number less than a given number, its argument n Write a program that: Asks the user to enter an integer Saves the entry as bound Passes bound onto eratos() Displays all the prime numbers less or equal to bound

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago