Question: Using vectors or arrays, 1. write a function named word_rev() that reverse any given word. 2. Write a program that will: Ask the user to

Using vectors or arrays, 1. write a function named word_rev() that reverse any given word.

2. Write a program that will:

Ask the user to enter a word.

Save the entry as word_entered.

Call word_rev on the entry Display the reversed entry (word_entered)

3. Write a function named prime() that determine whether or not a given number n (greater than one) is prime. The algorithm:

If n is even then n is not a prime number except n = 2

For all odd numbers less or equal to the square root of n, if any of them divide n, then n is not prime

4. Write a program that:

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

6. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!