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

  Characterization technology for nanomaterials

Calculate the reciprocal lattice of the body-centred cubic and Show that the reciprocal of the face-centred cubic (fcc) structure is itself a bcc structure.

  Calculate the gasoline savings

How much gasoline do vehicles with the following fuel efficiencies consume in one year? Calculate the gasoline savings, in gallons per year, created by the following two options. Show all your work, and draw boxes around your answers.

  Design and modelling of adsorption chromatography

Design and modelling of adsorption chromatography based on isotherm data

  Application of mechatronics engineering

Write an essay on Application of Mechatronics Engineering

  Growth chracteristics of the organism

To examine the relationship between fermenter design and operating conditions, oxygen transfer capability and microbial growth.

  Block diagram, system performance and responses

Questions based on Block Diagram, System Performance and Responses.

  Explain the difference in a technical performance measure

good understanding of Mil-Std-499 and Mil-Std-499A

  Electrode impedances

How did this procedure affect the signal observed from the electrode and the electrode impedances?

  Write a report on environmental companies

Write a report on environmental companies

  Scanning electron microscopy

Prepare a schematic diagram below of the major parts of the SEM

  Design a pumping and piping system

creating the pumping and piping system to supply cool water to the condenser

  A repulsive potential energy should be a positive one

Using the data provided on the webvista site in the file marked vdw.txt, try to develop a mathematical equation for the vdW potential we discussed in class, U(x), that best fits the data

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