Write program called nprimes which takes single integer

Assignment Help Other Engineering
Reference no: EM131101152

E15: Fundamentals of Digital Systems - Fall 2010 - HOMEWORK 10

1) Write a program called nprimes which takes a single integer input n on the command line. It should produce as output the first n prime numbers, one on each line. For example, running "nprimes 4" should produce the output 2 3 5 7, with each number on its own line.

2) Write a program called stats which takes its input from either a file named on the command line, or from standard input. The input should consist of real numbers, both positive and negative, separated by spaces and/or newlines. The program's output should consist of three lines: the first line should print the minimum number input, the second should print the maximum, and the third should print the average of all the numbers input.

Use the %g or format specifier to print the min, max, and average. The program should generate an error if the input contains no numbers.

3) Write a program called bigsum which can sum a set of numbers larger than the maximum long integer size (about 19 decimal digits). Your program should take its input either from a file named on the command line, or from standard input. The input should consist of nonVnegative integers of up to 32 digits, separated by spaces and/or newlines. The output is a single number equal to the sum of all of the inputs. Your program should generate an error if any input is longer than 32 digits, or if the output cannot be stored in a 32 digit number.

4) Write a program called wordsearch which takes its input either from a file named on the command line, or from standard input. The input should consist of two parts: first, a block of m lines of n uppercase letters, with m and n both less than 256; then a single blank line, followed by a set of words to search for, one on each line, in upper or lower case. Each word should be hidden within the original block of text, horizontally, vertically, or diagonally, forwards or backwards. Your program should output for each word, the starting and ending row and column where the word can be found, with (0, 0) being the topVleft position, or indicate whether the word was not found.

Attachment:- homework10.zip

Reference no: EM131101152

Questions Cloud

Gulf weighted average cost of capital : The Gulf Company's cost of equity is 16 percent. Its before-tax cost of debt is 13 percent, its average tax rate is 40 percent. Gulf does not have any preferred equity. If it's debt ratio is 30 percent, find Gulf's weighted average cost of capi..
Question regarding the tgif sportswear : The firm has a target debt-to-equity ratio of 40 percent. Its cost of equity is 14% and its cost of debt is 7%. The tax rate is 34%. Should TGIF Sportswear expand its T-shirt line?
Which project has the higher mirr : whose costs and cash flows are shown below:The projects are equally risky, and their cost of capital is 12%. You must make a recommendation, and you must base it on the modified IRR (MIRR). Which project has the higher MIRR?
What are the documentation requirements with regard to taxes : What are the documentation requirements with regard to taxes and tariffs for international trade?
Write program called nprimes which takes single integer : E15: Fundamentals of Digital Systems - Fall 2010 - HOMEWORK 10. Write a program called nprimes which takes a single integer input n on the command line. It should produce as output the first n prime numbers, one on each line
What is the role of the companies creditor arrangement act : What is the role of the Companies' Creditor Arrangement Act with respect to developing contractual arrangements that fend off insolvency?
Which should actually be selected : Which project would be selected, assuming they are mutually exclusive, using each ranking method? Which should actually be selected?
How many presentation orders are possible for the first day : Three students present per day. How many presentation orders are possible for the first day?
Calculate the npv and irr for each type of truck : Annual net cash flows include depreciation expenses. Calculate the NPV and IRR for each type of truck, and decide which to recommend.

Reviews

Write a Review

Other Engineering Questions & Answers

  What input is required to get a zero volt output

What input is required to get a zero volt output? What binary output is produced by an input of 3.04 volts? Suppose the output is found to be 1F4h. What is the possible input voltage?

  Calculate the single pass conversion of a in the reactor

The reaction A giving 2B+C takes pace in a catalytic reactor. The reactor effluent is sent to a separator. Calculate the single pass conversion of A in the reactor and molar ratio of recycle to feed.

  Balloons of a thin but tough plastic

Suppose we construct these balloons of a thin but tough plastic having a density such that each square meter has a mass of 5.00 g. We inflate them with a very light gas whose mass we can neglect

  Explain how the microstructures given had formed

Explain how the microstructures above had formed. Assume that the eutectoid diagram has the At C = 0%, A3 = 900°C coordinates.

  Ryanair long-haul aircraft requirements

You should give an indication of market size and revenue opportunity. Second, what aircraft-related attributes would ideally be needed in order for a long-haul low-cost operation to be successful?

  The location will be identified in the feasibility

group 5 will be starting up a fictitious military aviation maintenance department. it was identified that a unit was

  Spatial and temporal analysis of travel patterns

Spatial and temporal analysis of travel patterns of no-car households - Identify spatial gaps in public transport supply based on social needs of no-car household owners.

  Floating point implementation of the radix

Fixed point and floating point implementation of the radix 2 FFT algorithm. Comparison of accuracy of the fixed point with floating point, sensitivity analysis to word size, pre-scaling and rounding.

  Iron loss and copper loss

What is the different between iron loss and copper loss?

  Determining the fluid in rigid-body motion

The tank of liquid in the figure accelerates to the right with the fluid in rigid-body motion.

  Develope a strategic vision and sense of mission

Why is it important to develope a strategic vision and sense of mission before proceeding? Why is it important to politically know the key stakeholders and ensure they are in agreement before proceeding?

  How many 8-bit ports are there on the mc9s12dp256b

a how many pin connections are there on the mc9s12dp256b microcontroller chip?b how many 8-bit ports are there on the

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