One time for the entire number set

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

Part A) create a program that will read in one of a list of integers and test to see whether or not each one is

prime (the numbers are listed in the file "ints.txt" ).

Note the file "ints.txt" contains:

8
25
101
5001
10213
56777
765321
317971
1028743
23498271
987278023
1768374681

You must run your program one time for the entire number set. Test for EOF (or use the function feof()) to know when to stop

processing. You are to determine if each integer read is prime or not, and output the result to stdout. If a

number is prime, your output should read:

101 = 1 x 101

101: PRIME Number

For a number that turns out not to be prime, your output should read:

333 = 1 x 333 333 = 3 x 111 333 = 9 x 37 333: NOT A PRIME Number
(Note:use loops, conditionals and flags in the program)
PartB) Revise your program of Part A to handle a range of integers as specified by the user. You are to only make minor changes to your code. Such changes might include changing the state of the display_factors flag as well as changing the structure of your outer loop. In part (b), your output should now just list ONLY the prime numbers in the given range and NOT the intermediate factors OR the numbers that are not prime. Only test for ranges that have a start number greater than 3. For example, the user can request the program to find all prime numbers in the range of 900 to 1000. In this case, the output should be the following: 907: PRIME Number 911: PRIME Number 919: PRIME Number 929: PRIME Number 937: PRIME Number 941: PRIME Number 947: PRIME Number 953: PRIME Number 967: PRIME Number 971: PRIME Number 977: PRIME Number 983: PRIME Number 991: PRIME Number 997: PRIME Number
Pls Make sure to Post both Codes(part A and B) and flowchart(if u can)

Reference no: EM13167907

Questions Cloud

Calculate the number of bridge hands : Calculate the number of bridge hands which contain and calculate the probability of being dealt each of the hands in parts (a), (b), and (c). Give your answers to 5 decimal places.
Categorize the efficiency in terms : Consider the followimg nested loop contruct. Categorize the efficiency in terms of the variable n using "big-O" notation. Suppose the statements represented by the elipsis
Define an error limit for approach : To construct the Hermite polynomial to approximate the price sin0.34 and define an error limit for approach used and compared with the actual error.
What dangerous chemical is released : when hydrochloric acid comes in contact with potassium permanganate, what dangerous chemical is released?
One time for the entire number set : You must run your program one time for the entire number set. Test for EOF (or use the function feof()) to know when to stop processing. You are to determine if each integer read is prime or not, and output the result to stdout
Smallest exponent that can be stored using this 16 bit stand : storing number in a string of 16 bits, the first bit is used for the sign of the number, and the next 5 bits store the exponent plus the bias, and the remaining 10 bits store the mantissa.  The bias is 15. What is the smallest exponent that can be st..
Determine the theoretical yield of the nacl product : The NaHCO3 is the limiting reactant and the HCl is the excess reactant in this experiment. Determine the theoretical yield of the NaCl product.
Calculate the average density of the star : A star is estimated to have a mass of 1 multiplied by 1036 kg. Assuming it to be a sphere of average radius 6.5 multiplied by 105 km, calculate the average density of the star in units of grams per cubic centimeter.
Create a system of equations : Create a system of equations that includes one linear equation and one quadratic equation and create a rational equation that has an extraneous solution.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Design and write a c++11/fltk game program

The project is to design and write a C++11/FLTK game program with a graphical user interface. The game is based on "pancake sorting," which actually has some mathematical significance.

  How do you generate arrays, random numbers

How do you generate arrays, random numbers and multiply and add rows, columns and diagonals in C

  Create a bar chart showing the average monthly mean temperat

Write a ++ program to create a bar chart showing the average monthly mean temperature for College Station from 2004 to 2013. The point of the exercise is to compute the sie and location of the rectangles rather than explicitely hardcode that informat..

  Calculate the component voltages

Calculate the component voltages for the following series resonant RLC circuit

  Businesspartner class that contains a first name

Create a BusinessPartner class that contains a first name, company name, and a telephone number. Create a Contacts class that contains a dynamically allocated array of BusinessPartners as well as the owner's name and cell phone number.

  Program that stores a series of numbers in a binary tree

Write a program that stores a series of numbers in a binary tree

  Write a scanf statement to read in one number (int

1) Write a scanf statement to read in one number (int), and another statement to print out that number.

  Create a program that displays the number of days in a month

Create a program that displays the number of days in a month. Use a 12-element one-dimensional array to store the number of days in each month (use 28 for the number of days in February).

  Write c program-visual studio to scan multiple text files

Write program in C or C++ and Visual Studio to scan multiple text files and count number of occurrences of each word in those files. Use binary tree to keep track of all words.

  Program that compares the number of possible sequences

Write a c++ program that compares the number of possible sequences of the length L that can be generated. The program must output a formatted list comparing the number of possible sequences for L=5,6,7,8,9. given size N=9

  Write a program to find the middle element in a linked list

1. Write a program to check if there is a loop in a linked list. Create a loop in a linked list and use your method 'isLoop' to identify that the loop exists. The method isLoop should return a Boolean type.2.

  Create constructor function which takes no inputs

You must have the constructor function which takes no inputs and randomly generates the 5 letter string for name and random integers from 20 to 40 for both age and class size.

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