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)
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.
|