Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
c++
![4:39
اريج جدید
All Media
16/01/2021, 4:39 PM
uäubill elälJI asob x
h Assignment
Final Lab Exam2021.pdf
%20Exam2021.pdf
1/ 1
1s Semester 2020/2021
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) If m is negative or zero then the function will retum false.
2) If m is between I and 3 then the function will return true.
3) If m is an even number then the function will return false.
4) Otherwise, the function should check whether the n is prime number and retum 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.
The program will print the following sample output:
Sample 1:
Enter a number (x) :
3e
The prime factors of number 30:
Arr(@]=2 Arr[1]=3 Arr[2]=5
Sample 2:
Enter a number (x) :
6s065
The prime factors of number 65865:
Arr[e]=s Arr[1]=7_Arr[2]=11 Arr[3]=13](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6a692d8e-ba2b-4196-9c51-7ddb3ce8fa08%2F6faff5cd-a7e3-4338-accc-99fb8d0574df%2F9ahdy7g_processed.jpeg&w=3840&q=75)
Transcribed Image Text:4:39
اريج جدید
All Media
16/01/2021, 4:39 PM
uäubill elälJI asob x
h Assignment
Final Lab Exam2021.pdf
%20Exam2021.pdf
1/ 1
1s Semester 2020/2021
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) If m is negative or zero then the function will retum false.
2) If m is between I and 3 then the function will return true.
3) If m is an even number then the function will return false.
4) Otherwise, the function should check whether the n is prime number and retum 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.
The program will print the following sample output:
Sample 1:
Enter a number (x) :
3e
The prime factors of number 30:
Arr(@]=2 Arr[1]=3 Arr[2]=5
Sample 2:
Enter a number (x) :
6s065
The prime factors of number 65865:
Arr[e]=s Arr[1]=7_Arr[2]=11 Arr[3]=13
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education