Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that contains the following: The PrNumber user-defined function: The function is called PrNumber, which takes a given integer number (m), and

image text in transcribed

Write a C++ program that contains the following: The PrNumber user-defined function: The function is called PrNumber, which takes a given integer number (m), and returns a boolean value that indicates whether m is prime number or not. The function should consider the following conditions: 1) Ifm is negative or zero then the function will return false. 2) Ifm is between 1 and 3 then the function will return true. 3) Ifm is an even number then the function will return false. 4) Otherwise, the function should check whether the n is prime number and return true, or it's not a prime and return false. Hint: The prime number is a number that is greater than 1 and divided by 1 or itself. The prime numbers can't be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17, 19, 23... are the prime numbers. In the main function, the program will ask the user to enter a number (N), and then it will store all prime factors of N in Array (using the defined PrNumber function) after that print it. C++ PROGRAM The program will print the following sample output: Sample 1: Enter a number : 30 The prime factors of number 30: Arr[@]=2 Arr(1)-3 Arr[2]=5 Sample 2: Enter a number (x): 65065 The prime factors of number 65065: Arr[0]=5 Arr[1]=7 Arr[2]=11 Arr[3]=13

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

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago