Write a program that finds and displays all the odd numbers between 1 and N. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that finds and displays all the "odd numbers" between 1 and N. The value of N is an integer entered by the user and should be a positive value. a) Prompt the user to input a positive integer. b) Ask them to re-enter if it's not a positive value. c) Identify and display the odd values between 1 and N. Print them on the same line separated by a space or tab. d)What's the average of those odd numbers? Compute and display the average as well. Write a program that finds and displays all the "odd numbers" between 1 and N. The value of N is an integer entered by the user and should be a positive value. a) Prompt the user to input a positive integer. b) Ask them to re-enter if it's not a positive value. c) Identify and display the odd values between 1 and N. Print them on the same line separated by a space or tab. d)What's the average of those odd numbers? Compute and display the average as well.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Differentiate between and provide examples of voluntary versus involuntary payroll deductions. Why are deductions from employees' earnings classified as liabilities for the employer? What is the...
-
What are the SDGs ? What is their history? How do they support global sustainability agenda?
-
Question 5 (a) Assuming you have completed your master's degree programme and employed as a director in one of the public sector institutions in your country. Generally, as a bureaucrat, if you are...
-
Telstar Limited was incorporated on 2 January 2015. On 3 January 2015, the company ordered plant from Germany at a cost of E1 million. The plant was loaded free on board in Hamburg on 1 March 2015,...
-
If an electron's position can be measured to a precision of 15 nm, what is the uncertainty in its speed? Assuming the minimum speed must be at least equal to its uncertainty, what is the electron's...
-
Which of the following are sets of linearly independent functions? (a) x, x2, x6; (b) 8, x, x2, 3x2 - 1; (c) sin x, cos x; (d) sin z, cos z, tan z; (e) sin x, cos x, eix; (f) sin2 x, cos2 x, 1; (g)...
-
The test statistic F is never greater than 1. In Exercises 7 and 8, determine whether the statement is true or false. If the statement is false, rewrite it as a true statement.
-
Redfern Corporation, a calendar year taxpayer, has been an S corporation for several years. Rod and Kurt each own 50% of Redferns stock. On July 1 of the current year (assume a non-leap year),...
-
Schedule of Cash Collections of Accounts Receivable Office World Inc. has "cash and carry" customers and credit customers. Office World estimates that 25% of monthly sales are to cash customers,...
-
Gourmet Coffee (GC) is a specialty coffee shop that sells roasted coffee beans. It buys green beans, roasts them in its shop, and then sells them to the consumer. GC estimates that it sells about...
-
An experiment is set-up with a monochromatic light source, a double slit, and a screen, similar to what is shown on page 7-2 of your lab manual. The experimenter measures and sketches the intensity...
-
Margo buys music CDs and movies on DVDs. The table below shows her total utility from each good. a) Draw graphs showing Margo's utility from music CDs and from movies on DVDs. (5 marks) b) Compare...
-
what extent do social networks facilitate cross-cultural communication and understanding, and what are the limitations that hinder true global connectivity ?
-
A "me-too" brand can employ a variation on central positioning by inhabiting a clone position. (Apply walmart to this strategy under central positioning strategy and how does walmart uses "me-too"?
-
Suppose the Yearly market demand for compact cars in Montana is given by Qd=1,000-5P, and the market supply for those cars is given by Qs=350+15P, where P = price (per car) a. In equilibrium, how...
-
Star TV sells TV sets. It does not sell smart TVs so customers do not come to Star TV if they want to purchase smart TVs. (Click the icon to view the additional information.) To choose a cutoff...
-
You are going to receive $100 four years from today. If the discount rate is 5 percent compounded annually, what will be the present value of the $100 two years from today?
-
Given that all the choices are true, which one concludes the paragraph with a precise and detailed description that relates to the main topic of the essay? A. NO CHANGE B. Decades, X-ray C. Decades...
-
Define the variables x and y as x = 5.1 and y = 4.2, then evaluate: (a) 3/4 xy 7x/y2 + xy (b) (xy)2- x + y/(x-y)l2 + x + y/2x - y
-
Create the following vector C. c = [1.5 2 2.5 3 3.5 4 4.5 5 9.6 9.1 8.6 8.1 7.6 7.1 6.6 6.1] Then use MATLAB's built-in reshape function and the transpose operation to create the following matrix D...
-
Using the linspace command, create a row vector (assign it to a variable named Nines) with nine elements that are all 9.
-
For each scenario below, describe which of the five general conditions that undermine independence in appearance is most relevant. a. An auditor recommends its audit clients' services to other...
-
Client-acceptance decisions have become increasingly important. This is mainly due to the increased risk of litigation against audit firms in some countries as a result of being associated with...
-
What is strategic analysis? Discuss the types of knowledge that auditors strive to obtain from the analysis.
Study smarter with the SolutionInn App