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

  Compare the basic features of http status codes

Compare the basic features of HTTP status codes with those of the FTP reply codes given by RFC 640. What is one way in which these codes are similar and one way in which they are different?

  What challenges think a computer forensic analyst

what challenges you think a computer forensic analyst and prosecutors would face when trying a case that involves digital evidence?

  Show how the hodgkin-huxley fast subsystem depends

Show how the Hodgkin-Huxley fast subsystem depends on the slow variables: i.e., show how the nullcline moves as and are changed, and demonstrate the saddle-node bifurcation in which and disappear.

  Calculate a checksum as ones-complement sum

Calculate a checksum as ones-complement sum of following 8-bit words #1 through #4, and then ones-complement that sum. Illustrate the 8-bit result.

  Determine the range

then performs the following analysis on the numbers: Determine the average number Determine the maximum number Determine the range (maximum - minimum) Displays a histogram that shows the numbers in each five-unit range

  It department staffing easier-less expensive as technologies

IT department staffing should become easier and less expensive as technologies simplify and become more mainstream. Agree or disagree and why?

  Find out the average cpi for the two executables compiled

Consider a program compiled using compilers A and B running on the same processor. Find out the average CPI for the two executables compiled by compilers A and B given that the processor has a clock cycle time of 1ns.

  What were the beliefs of moor and finnis

What were the beliefs of Moor and Finnis. How were they similar and how were they different. Explain if they would apply to users of cyberspace. If they do explain how, if they do not explain how and support your work.

  Write a program asks the user to enter a month

Write a program asks the user to enter a month (1 for January, 2 for February, and so on) and then prints the number of days in the month. For February, print "28 or 29 days". For example: Enter a mont: 5 30 days Do not use a separate if/else bran..

  Why software products has successful growth strategy

Software products like Linux be a successful growth strategy in "brutally competitive marketplace" in which it operates? Explain why or why not?

  Write a one-page paper describing these new activities

Propose three to five additional activities you think should be added to a Gantt chart to help you estimate resources and durations. Write a one-page paper describing these new activities.

  Analysis of competitive organization and possible threats

Analysis of competitive organization and possible threats and how organization is using E-Business Management facilities for daily activities? Limitations if any, adding more features for E-Business if required.

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