Write a code that checks whether the number taken from the user is positive or not,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a code that checks whether the number taken from the user is positive or not, and if it is positive, print the odd numbers up to that number on the screen using a for loop. If the number taken from the user is not positive, the code should return an error message. Q.2) Write a C++ program that takes a positive integer N from the user and then calculates the sum of the squares of numbers from 1 to N. Later, verify this sum using a direct formula. Find the formula to be used for verification. Q.3) Write a program that requests a number input from the user. Keep asking for a new input as long as the entered number is negative. End the program when the entered number is positive. Q.4) Write a C++ code to get a series of increasing numbers from the user. See the details below Stop getting numbers when a negative number is entered. Stop when the series becomes non-increasing or decreasing. Skip if the number entered is 0. That is, do not include it in the calculation of the average. At the end, print the average of all the numbers. Q.5) Write a C++ program that takes the starting and ending numbers as input from the user. If the difference between these two numbers is greater than 1, print the numbers in between on the screen, using a do-while loop Q.6) XLab laboratory company calculates the cost of an assay by multiplying it by the assays (in minutes) along with the unit cost. The unit cost depends on the code given to the person giving the assay, given code. If the code is between 100-139, the unit cost per analysis is 200KTL, If the code is between 140-399, the unit cost per analysis is 350 TL, otherwise, if the code is between 400 - 599, the unit cost per analysis is 400 TL. In the full program: Write a function that takes code and cost as parameters and displays the total cost. Write a code that checks whether the number taken from the user is positive or not, and if it is positive, print the odd numbers up to that number on the screen using a for loop. If the number taken from the user is not positive, the code should return an error message. Q.2) Write a C++ program that takes a positive integer N from the user and then calculates the sum of the squares of numbers from 1 to N. Later, verify this sum using a direct formula. Find the formula to be used for verification. Q.3) Write a program that requests a number input from the user. Keep asking for a new input as long as the entered number is negative. End the program when the entered number is positive. Q.4) Write a C++ code to get a series of increasing numbers from the user. See the details below Stop getting numbers when a negative number is entered. Stop when the series becomes non-increasing or decreasing. Skip if the number entered is 0. That is, do not include it in the calculation of the average. At the end, print the average of all the numbers. Q.5) Write a C++ program that takes the starting and ending numbers as input from the user. If the difference between these two numbers is greater than 1, print the numbers in between on the screen, using a do-while loop Q.6) XLab laboratory company calculates the cost of an assay by multiplying it by the assays (in minutes) along with the unit cost. The unit cost depends on the code given to the person giving the assay, given code. If the code is between 100-139, the unit cost per analysis is 200KTL, If the code is between 140-399, the unit cost per analysis is 350 TL, otherwise, if the code is between 400 - 599, the unit cost per analysis is 400 TL. In the full program: Write a function that takes code and cost as parameters and displays the total cost.
Expert Answer:
Answer rating: 100% (QA)
The image youve provided contains several questions aski... View the full answer
Related Book For
Database Systems A Practical Approach to Design Implementation and Management
ISBN: 978-0132943260
6th Edition Global
Authors: Thomas Connolly, Carolyn Begg
Posted Date:
Students also viewed these programming questions
-
This question concerns lexical grammars. (a) Tree Adjoining Grammars contain two types of elementary tree. (i) What are these trees called? [1 mark] (ii) If one were building a grammar for English...
-
Describe, in detail, how the heapsort algorithm works. [10 marks] Show that the worst-case cost of heapsort is O(n log n). [6 marks] Would it be possible to implement a variant of heapsort based on a...
-
Being employed as a casual barista in a local caf with a flourishing catering business called 'Brown's Caf' , where you are supervised by the caf owner, Jessica Williams. The company employs 20...
-
Describe the two potential dangers of strategic alliances summarized by the initials H&M, and four ways that firms in alliance can build trust to minimize the risk of these dangers.
-
Alaska Corporation purchased 300 common shares of Burke Inc. for $23,400 and accounted for them using the fair value through other comprehensive income model. During the year, Burke paid a cash...
-
In emergency braking, a certain car requires \(7.0 \mathrm{~m}\) to come to a stop from an initial speed of \(10 \mathrm{~m} / \mathrm{s}\). Use an argument based on work done on the car to determine...
-
Moses Manufacturing is attempting to select the best of three mutually exclusive projects, X, Y, and Z. Although all the projects have 5-year lives, they possess differing degrees of risk. Project X...
-
Explain the nature of auto correlation Suppose that a random sample of 200 twenty-year-old men is selected from a population and their heights and weights are recorded. A regression of weight on...
-
XYZ is a calendar-year corporation that began business on January 1, 2018. For the year, it reported the following information in its current-year audited income statement. Notes with important tax...
-
Prepare all the journal entries from March 31. (Please show as in double-accounting journal so the debit and the credit and each entry should balance). For several years, Arthur King dreamed of...
-
Janice loves classical music and the arts. In 1992 she married Joe, who's a fan of beer and whatever ball game is on television. At first Joe was willing to go to museums with Janice and Janice was...
-
The frequency of KRCC (the local NPR station) is 91.5 MHz (1 MHz= 1.0 x 106 Hz). What is the wavelength of the radiation traveling to your radio?
-
% 4 Normal text 4 Arial 21 3 12 4 BIUA GD 4 List 5 common over-the-counter (OTC) medications and other retail products patients may use without a prescription. List Their Pharmadynamic,...
-
1. 2. An industrial wastewater is known to contain stearic acid (C18H3602), glycine (C2H5O2N), and glucose (C6H12O6). The results of laboratory analysis indicate that organic nitrogen = 12 mg N/L,...
-
Consider the unit hypersphere (with radius r = 1). Inside the hypersphere inscribe a hypercube (i.e., the largest hypercube you can fit inside the hypersphere). An example in two dimensions is shown...
-
Fill in the blanks: To assess the accuracy of a laboratory scale, a standard weight that is known to weigh 1 gram is repeatedly weighed 4 times. The resulting measurements (in grams) are: 0.95, 1.02,...
-
Dr. Chan obtained a $15,000 demand loan at prime plus 1.5% on September 13 from the Bank of Montreal to purchase a new dental X-ray machine. Fixed payments of $700 will be deducted from the dentists...
-
Analyze the RDBMSs that you are currently using. What types of relational languages does the system provide? For each of the languages provided, what are the equivalent operations for the eight...
-
Discuss why schema control may be a useful facility for some applications.
-
Describe the IT governance mechanisms that could be implemented in your organization to improve how IT and data is managed?
-
Reconsider the data from Problem 57 (Orpheum Productions lighting enhancement). Assume that any money not invested in the lighting enhancements will be placed in an interest-bearing account earning...
-
An investor has \($100,000\) to invest in a business venture, or she can earn 10 percent/year with a \($100,000\) certificate of deposit for 4 years. Three possible business ventures have been...
-
This problem is related to Problem 8. Jeff has $10,000 to invest for a period of 5 years. The following three alternatives are available at his bank: Data from problem 8 Jeff has $10,000 to invest...
Study smarter with the SolutionInn App