Write a program to determine if a natural number has only 2


Program: Write a program to determine if a natural number has only 2 and/or 3 as prime factors and how many of each factor (2 and 3) it does have.

Write your program from scratch (you can reference other examples to get started with the basic structure of a program) and name it prime23.cpp. The program should meet the following requirements:

Part 1: Prompt (print a message to the user) to enter a natural number. [i.e. use cout]

Part 2: Receive the integer input from the user. [i.e. use cin ]

Part 3: Implement your algorithm (using while loops and if statements).

Part 4: Print either "Yes" and a count of 2 factors and a count of 3 factors (i.e. an input of 24 would print: Twos=3, Threes=1) or "No" if the number has neither a factor of 2 nor 3.

You have to satisfy the requirements specific in the instruction - It must compile with no errors and follow the directions.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a program to determine if a natural number has only 2
Reference No:- TGS0947782

Expected delivery within 24 Hours