Question: Write a code that checks whether the number taken from the user is positive or not, and if it is positive, print the odd
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.
Step by Step Solution
There are 3 Steps involved in it
Certainly Here are solutions to the provided programming tasks 1 Java code to check if a number is p... View full answer
Get step-by-step solutions from verified subject matter experts
