Write a program that reads in an integer value

Assignment Help Basic Computer Science
Reference no: EM13219628

Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.

Reference no: EM13219628

Questions Cloud

What is the amount to be paid : What is the amount to be paid? Does profit increase of decrease and if the invoice is paid on December 31, 2011
How much to qualify to borrow for 15year fixed-rate mortgage : Monthly Gross Income: $3,000 Money you have in savings for a down payment: $9,500 You have monthly payments for all existing debts of $400 How much do you qualify to borrow (assume 28% debt to income ratio and 10% down payment)
How many grams of propane must be burned to produce heat : How many grams of propane must be burned to provide the heat needed to melt a 75.0-g piece of bromine (at its melting point) and bring the resulting liquid to a boil (with no vapourization)? Assume a constant pressure of 1 bar and use the followin..
Complete the balance sheet and current ration : Given the information, complete the balance sheet and Current ration
Write a program that reads in an integer value : Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.
Write a program in matlab and vb to ask : Write a program in Matlab and VB to ask the user the maximum error emax (e.g., 0.1, 0.01, 0.05, etc.), keep adding terms in S, until the following condition is satisfied: emax > |S - Sk| Print the minimum number of k to satisfy the above condition..
Nutritional strategy of 2 types of chemoautotrophs : describe the nutritional strategy of 2 types of chemoautotrophs". contrast chemoautotrophs and heterotrophs as to carbon and energy sources and other unique strategies they may have"
Eliminate the transitive dependency in this relation : Vendor is functionally dependent on Compname and Compname is functionally dependent on Prodname. Eliminate the transitive dependency in this relation and form 3NF (third normal form) relations.
What is the change in centimeters : The evaporation rate from the surface of a 3,650 - acre lake is 100 acre-feet/day . estimate the depth change in the lake in feet during a 1 - year priod if the net inflow to the lake is 25 cfs is the depth increasing ? what is the change in centimet..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What value would be returned from call to its size() method

If a collection stores 5 objects, what value would be returned from a call to its size() method?

  Develop timeline on computer using microsoft word

Use Microsoft Word, Excel or PowerPoint to develop timeline on computer. Create your own timeline and take a picture, saving file on computer as .jpg or .gif.

  Types of pre-created objects that can be used on web sites

Types of pre-created objects that can be used on Web sites. Describe the objects you find and what they are used for. Include links to the sites you used in your research.

  Evaluate situation if you lack behind schedule on project

Evaluate a situation where you have fallen behind schedule on a project. How could more effective scheduling have allowed the project to stay on track?

  Write the definition of the function min and a program

write the definition of the function min and a program to test this function. Add the function max to the class arrayListType to return the largest element of the list. Also, write the definition of the function max and a program to test this func..

  Heptadeca class that encapsulates a heptadeca number

Write a Heptadeca class that encapsulates a Heptadeca number value. A Heptadeca number is one with 17 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G. The methods the class has are: public void read(), public void set(String), public voi..

  Perceptions of product create its personality

Perceptions of product create its personality. Bottom, round the back. And even there they are ugly. Is that essential? Could they not, in some small degree, give pleasure?

  Customer from the first part of this discussion

Suppose that you learn that the customer from the first part of this discussion is unsure as to whether the database is going to run only during normal business hours or whether it needs to run 24 hours / 7 days a week. Assess the importance of kn..

  Make report to print gross earnings and tax payable

Your report is to print the gross earnings, tax payable, medical levy and net earnings for each employee. At the end of the report, print the total gross earnings, total tax, total medical levy and total net earnings.

  Positive and negative characteristics of hybrid databases

A idea that several of the main database vendors have come up with is a hybrid database that integrates the concepts of both OO and Relational databases.

  How implement memory allocation with strings

how implement memory allocation with strings.

  What three functions are the most important

DBMS has many functions. What three functions are the most important and why are they most important?

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