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)
Certainly Here are solutions to the provided programming tasks 1 Java code to check if a number is p... 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
-
5) A company has 200mm of debt, 50mm of cash, 25mm shares of stock trading at $10. It has operating income (EBIT) of 40mm and D&A of 10mm. What is EV/EBITDA and debt/EBITDA? 6) Ligand Pharmaceuticals...
-
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...
-
You're preparing the annual report for FretCo Guitar Corporation. For each of the following types of information, select an appropriate chart or visual to illustrate the text. Explain your choices....
-
A new table has been requested to support tracking automated emails sent to customers. Create the table and add data as described below. Tablename: email_log Columns: emailid (numeric), emaildate...
-
If the Grand Canyon Railway's volume decreases by \(8 \%\), by what percentage will its operating income decrease? a. \(48 \%\) b. \(1 \%\) c. \(26.16 \%\) d. \(8 \%\)
-
Multiple-Choice Questions 1. Which of the following will increase the breakeven quantity? a. A decrease in overall fixed costs b. A decrease in the marginal costs c. A decrease in the price level d....
-
Eastport Inc. was organized on June 5 , Year 1 . It was authorized to issue 4 9 0 , 0 0 0 shares of $ 9 par common stock and 6 5 , 0 0 0 shares of 5 percent cumulative class A preferred stock. The...
-
Kevin has met with you and Brenda. Brenda has explained his current duties as an enduring power of attorney holder. She has also provided Kevin with a copy of Norman's will and briefly explained his...
-
The capital structure of ABC Pvt. Ltd is as follows: Equity share capital (eachshareofRs.10) = Rs.16, 00,000 Debentures with a coupon rate of 10%= Rs. 10, 00,000 Reserves and surplus= Rs.15, 00,000...
-
What is Pfizers goals and measures for the financial perspective of the Balanced Scorecard
-
Jonah wants to predict the price of a watermelon using a model with 6 predictors and a sample with 345 observations. Weight (one of the predictors, in kilograms) has a coefficient of bj = 8.55 and a...
-
Find maxima and minima of the function y = x-4x+5
-
How did the development of the computer impact the Cognitive Psychology Movement? How do you believe the Cognitive Psychology Movement would have been impacted if the computer had not been developed
-
Bridge City Consulting bought a building and the land on which it is located for $182,000 cash. The land is estimated to represent 70 percent of the purchase price. The company paid $22,000 for...
-
Bookmarks Profes Tab Window Help Nassau Community College Question 7-ACC 201 ducation.com/ext/map/index.Meconicon&external browsers0&launchUrishttps 0 dodane JAN252F%252Fnce.sin.suny Help Save & E...
-
The Strahler Stream Order System ranks streams based on the number of tributaries that have merged. It is a top-down system where rivers of the first order are the headwaters (aka outermost...
-
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?
-
Computing unit cost for department and for completed units} with beginning inventory Robert E. Lee Company has two production departments. Blending had 1,000 units in process at the beginning of the...
-
Identifying cost flows in process cost system} List in columnar form the transactions and the accounts debited and credited to reflect the flow of costs through a process cost accounting system for...
-
Departmental cost work sheet analysis; cost of production} summary, three departments, no beginning inventories Goode Manufacturing Co. has three departments and uses the process cost system of...
Study smarter with the SolutionInn App