SlideShare a Scribd company logo
Please use the code below and make it operate as one program. Notating what you did to make it
work would also be greatly appreciated.
#include <iostream>
using namespace std;
void getValidUserinputPosNumGTO(int& userInput)
{
do {
cout << "Please enter a positive integer greater than zero: ";
cin >> userInput;
} while (userInput <= 0);
}
int main()
{
int userInput;
getValidUserinputPosNumGTO(userInput);
cout << "The user entered: " << userInput << endl;
return 0;
}
#include <iostream>
int CountOfDivisors(int num)
{
int count = 0;
for (int i = 1; i <= num; i++)
{
if (num % i == 0)
{
count++;
}
}
return count;
}
int main()
{
int num = 24;
int count = CountOfDivisors(num);
std::cout << "The number " << num << " has " << count << " divisors." << std::endl;
return 0;
}
#include <iostream>
bool IsSquare(int num)
{
int count = 0;
for (int i = 1; i <= num; i++)
{
if (num % i == 0)
{
count++;
}
}
return (count % 2 != 0);
}
int main()
{
int num = 25;
bool isSquare = IsSquare(num);
if (isSquare)
{
std::cout << num << " is a square number." << std::endl;
}
else
{
std::cout << num << " is not a square number." << std::endl;
}
return 0;
}
#include <iostream>
bool IsPrime(int num); // Declaration of the IsPrime function
void DisplayPrime(int num)
{
if (IsPrime(num))
{
std::cout << num << " is a prime number." << std::endl;
}
else
{
std::cout << num << " is not a prime number." << std::endl;
}
}
int main()
{
int num = 17;
DisplayPrime(num);
return 0;
}
bool IsPrime(int num) // Definition of the IsPrime function
{
if (num <= 1)
{
return false;
}
for (int i = 2; i <= num / 2; i++)
{
if (num % i == 0)
{
return false;
}
}
return true;
}
#include <iostream>
bool IsPrime(int num);
int main()
{
int num = 17;
if (IsPrime(num))
{
std::cout << num << " is a prime number." << std::endl;
}
else
{
std::cout << num << " is not a prime number." << std::endl;
}
return 0;
}
bool IsPrime(int num)
{
if (num <= 1)
{
return false;
}
for (int i = 2; i <= num / 2; i++)
{
if (num % i == 0)
{
return false;
}
}
return true;
}

More Related Content

Similar to Please use the code below and make it operate as one program- Notating.pdf

C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfC++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
andreaplotner1
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
Farhan Ab Rahman
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
Farhan Ab Rahman
 
C++ L05-Functions
C++ L05-FunctionsC++ L05-Functions
C++ L05-Functions
Mohammad Shaker
 
Statement
StatementStatement
Statement
Ahmad Kamal
 
oodp elab.pdf
oodp elab.pdfoodp elab.pdf
oodp elab.pdf
SWATIKUMARIRA2111030
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
vandna123
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
leovasquez17
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
leovasquez17
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdf
T17Rockstar
 
Penjualan swalayan
Penjualan swalayanPenjualan swalayan
Penjualan swalayan
Setiyo Agus Widjaja
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 
Computer Practical XII
Computer Practical XIIComputer Practical XII
Computer Practical XII
Ûťţåm Ğűpţä
 
C++ L06-Pointers
C++ L06-PointersC++ L06-Pointers
C++ L06-Pointers
Mohammad Shaker
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd marchRajeev Sharan
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
yash production
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
Mohammed Sikander
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
Sena Nama
 

Similar to Please use the code below and make it operate as one program- Notating.pdf (20)

C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfC++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
 
C++ L05-Functions
C++ L05-FunctionsC++ L05-Functions
C++ L05-Functions
 
Statement
StatementStatement
Statement
 
oodp elab.pdf
oodp elab.pdfoodp elab.pdf
oodp elab.pdf
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docxEJERCICIOS DE BORLAND C++ 2DA PARTE.docx
EJERCICIOS DE BORLAND C++ 2DA PARTE.docx
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdf
 
Penjualan swalayan
Penjualan swalayanPenjualan swalayan
Penjualan swalayan
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
Computer Practical XII
Computer Practical XIIComputer Practical XII
Computer Practical XII
 
C++ L06-Pointers
C++ L06-PointersC++ L06-Pointers
C++ L06-Pointers
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
 
C++ file
C++ fileC++ file
C++ file
 

More from seoagam1

Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions  44- The Watson Foun.pdfPrepare the Journal entries for each Transactions  44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
seoagam1
 
Prepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdfPrepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdf
seoagam1
 
Prepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdfPrepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdf
seoagam1
 
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdfPreoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
seoagam1
 
Prepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdfPrepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdf
seoagam1
 
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdfPreliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
seoagam1
 
Practice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdfPractice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdf
seoagam1
 
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdfPow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
seoagam1
 
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdfPovet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
seoagam1
 
Post your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdfPost your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdf
seoagam1
 
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdfPolitical Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
seoagam1
 
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdfpopulition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
seoagam1
 
Policymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdfPolicymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdf
seoagam1
 
polymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdfpolymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdf
seoagam1
 
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell  (d) Consider the following snippet of C code int i-a-.pdfPlz explainwell  (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
seoagam1
 
Please write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdfPlease write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdf
seoagam1
 
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdfPLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
seoagam1
 
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdfPlease use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
seoagam1
 
Please use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdfPlease use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdf
seoagam1
 
Please write code in C++ You are working on problem set- Project 2 (II.pdf
Please write code in C++ You are working on problem set- Project 2 (II.pdfPlease write code in C++ You are working on problem set- Project 2 (II.pdf
Please write code in C++ You are working on problem set- Project 2 (II.pdf
seoagam1
 

More from seoagam1 (20)

Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions  44- The Watson Foun.pdfPrepare the Journal entries for each Transactions  44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
 
Prepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdfPrepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdf
 
Prepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdfPrepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdf
 
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdfPreoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
 
Prepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdfPrepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdf
 
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdfPreliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
 
Practice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdfPractice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdf
 
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdfPow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
 
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdfPovet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
 
Post your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdfPost your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdf
 
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdfPolitical Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
 
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdfpopulition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
 
Policymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdfPolicymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdf
 
polymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdfpolymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdf
 
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell  (d) Consider the following snippet of C code int i-a-.pdfPlz explainwell  (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
 
Please write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdfPlease write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdf
 
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdfPLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
 
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdfPlease use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
 
Please use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdfPlease use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdf
 
Please write code in C++ You are working on problem set- Project 2 (II.pdf
Please write code in C++ You are working on problem set- Project 2 (II.pdfPlease write code in C++ You are working on problem set- Project 2 (II.pdf
Please write code in C++ You are working on problem set- Project 2 (II.pdf
 

Recently uploaded

Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Please use the code below and make it operate as one program- Notating.pdf

  • 1. Please use the code below and make it operate as one program. Notating what you did to make it work would also be greatly appreciated. #include <iostream> using namespace std; void getValidUserinputPosNumGTO(int& userInput) { do { cout << "Please enter a positive integer greater than zero: "; cin >> userInput; } while (userInput <= 0); } int main() { int userInput; getValidUserinputPosNumGTO(userInput); cout << "The user entered: " << userInput << endl; return 0; } #include <iostream> int CountOfDivisors(int num) { int count = 0; for (int i = 1; i <= num; i++) { if (num % i == 0) { count++; } } return count; } int main() { int num = 24; int count = CountOfDivisors(num); std::cout << "The number " << num << " has " << count << " divisors." << std::endl; return 0; }
  • 2. #include <iostream> bool IsSquare(int num) { int count = 0; for (int i = 1; i <= num; i++) { if (num % i == 0) { count++; } } return (count % 2 != 0); } int main() { int num = 25; bool isSquare = IsSquare(num); if (isSquare) { std::cout << num << " is a square number." << std::endl; } else { std::cout << num << " is not a square number." << std::endl; } return 0; } #include <iostream> bool IsPrime(int num); // Declaration of the IsPrime function void DisplayPrime(int num) { if (IsPrime(num)) { std::cout << num << " is a prime number." << std::endl; } else { std::cout << num << " is not a prime number." << std::endl; } }
  • 3. int main() { int num = 17; DisplayPrime(num); return 0; } bool IsPrime(int num) // Definition of the IsPrime function { if (num <= 1) { return false; } for (int i = 2; i <= num / 2; i++) { if (num % i == 0) { return false; } } return true; } #include <iostream> bool IsPrime(int num); int main() { int num = 17; if (IsPrime(num)) { std::cout << num << " is a prime number." << std::endl; } else { std::cout << num << " is not a prime number." << std::endl; } return 0; } bool IsPrime(int num) { if (num <= 1) { return false;
  • 4. } for (int i = 2; i <= num / 2; i++) { if (num % i == 0) { return false; } } return true; }