Write a program to determine a natural number

Assignment Help C/C++ Programming
Reference no: EM13694490

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.

Reference no: EM13694490

Questions Cloud

Protocol used to update the massive routing tables : What is the name of the protocol used to update the massive routing tables maintained on routers within the internet?
Object code for the subsequent program : Write down the object code for the subsequent program, assuming that it is not necessary to force extended addressing.
Write a literal representing the long integer : Write a literal representing the long integer value twelve billion.
Write a hexadecimal integer literal : Write a hexadecimal integer literal representing the value fifteen.
Write a program to determine a natural number : 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.
Find the complement of f : Find the complement of F(A,B,C) = AB + ( BC' * A) and reduce it. Show your work for the reduction using the axioms of boolean algebra. then, implement the simplified expression using AND,OR and NOT gates
Calculate the total amount of a meal purchased : Design your own HTML form and corresponding PHP page to calculate the total amount of a meal purchased as a restaurant.
Single dsl router : if an office had two computers connected via Ethernet layer 2 switch,  sharing a single dsl router connected to the internet, which error detection scheme would be more suitable for this scenario?
Rationale for declaring an array of objects of the class : Explain the dimension of the array and why you chose that number of elements for the object array.Can you give the answer ASAP?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Iterative programming problem solving approaches

Write a recursive function void reverse ( ) that reverse a sentence

  How many whole numbers they wish to enter

Write a program, which will ask the user how many whole numbers they wish to enter. The program will then read that many numbers, print them in the order they were entered, sort them in order by increasing value, and print them in sorted order.

  Write in c++. read an inputfile.txt

write in C++.  read an inputFile.txt which contains integers that are virutal addresses, and I am suppossed to translate that into physical addresses using a page table and a transition lookaside buffer

  Given the following test scores and grade equivalents

Given the following test scores and grade equivalents, write a function which is passed a score, and returns a letter grade based on the score entered. A number less than 0 or greater than 100 is invalid.

  Define a static method samecolor in the car class

Write an abstract class Car to implement the Comparable interface. Write a Truck class and a Sedan class to implement Car. define a static method sameColor in the Car class to find out weather a Truck and a Sedan has the same color.

  Performs a merge sort on 2 number sequences

Write a C program Sort.c that performs a merge sort on 2 number sequences produced by the program in Q1. Sort.c should spawn 2 processes and each of the children processes would exec() the Gen program to produce a sequence.

  Write a c++ statement that outputs the data stored

Write a C++ statement that declares student to be a personType object, and initialize its first name to "Buddy" and last name to "Arora".

  Translate than c source code

Why does Ada take so much more time to translate than C source code? What phase of the Ada translation takes the longest?

  Maze program

Maze program. In this assignment you will represent a maze with a binary tree. . The starting point is node N and the ending point is node Z.

  Draw a two-dimensional house seen from the front

Draw a two-dimensional house seen from the front, the way a child would: with a door, two windows, and a roof with a chimney. Feel free to add details; mabe have "smoke" come out of the chimney.

  Problems on oops

Problems on OOPS

  Program that evaluates a infix expression

Program that evaluates a infix expression using stacks terminated by an equal sign. for example: (4-2)-5)/(2+1)-2))=the expression will contain single digit and the operators +, -, *,/. Make sure to consider the operator precedence.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd