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

  Implement a class to represent a matrix

Implement a class to represent a matrix. While doing this exercise, you are allowed only to use C++ primitive types and arrays. You may not use STL in your Matrix definition. You must use dynamic memory.

  Counts all occurrences of a given string from such a bag

Write a C++ function that removes and counts all occurrences of a given string from such a bag.

  Write a program that contains a main function

Write a program that contains a main function and three other functions that will return various attribute information about an array of floating point

  Write c function to sort one dimensional integer array

Consider the values sorted in the array. Sort it in ascending order using Bubble sort technique showing all iterations: write C function to sort one dimensional integer array in ascending order.

  Using an abstract class with only pure virtual functions

Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle. Give each class some uique appropriate attributes and behaviors that it does not have in common with oth..

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  Write a c program that asks for and reads in two integers

Write a C program that asks for and reads in two integers and then reports if one is a multiple of the other.

  Users to input two forces by their components

write a programm to ask users to input two forces by their components of (Fx1,Fy1) and (Fx2,Fy2) from the keyboard.call twice the function to display both magnitude and direction angle of two forces on the screen.add two forces and display both magni..

  Linked list with first node pointer p.

Complete the code for a function that replaces each occurrence of value x by value y in a linked list with first node pointer p.

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

  Two types of sporting teams

Select two types of sporting teams and de?ne subclasses for them. These classes shouldinherit from a base team class such as that created in Exercise 1. Include uniquecharacteristics about the sport.

  Write a program to calculate students average test scores

Write a program to calculate students average test scores

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