7. Write a program that prompts the user for a positive integer n between 10 and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. Write a program that prompts the user for a positive integer n between 10 and 100 and then prints the sum of the integers that are evenly divisible by 4 or 6, but not both, from 1 to n. Input validation is required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Enter a positive integer between 10 and 100: 5 The number you entered is invalid. Try again. Enter a positive integer between 10 and 100: 20 The sum is 72. 8. Write a program that prompts the user to enter 3 integers and then prints the current average, displayed to 2 decimal places, of the numbers that were inputted at that time for each user input using a loop statement. Input validation is not required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Hint: Use printf("%.2f", num) to display num to 2 decimal places. Enter an integer number: 5 After 1 number(s), the average is 5.00. Enter an integer number: 6 After 2 number(s), the average is 5.50. Enter an integer number: 10 After 3 number(s), the average is 7.00. 7. Write a program that prompts the user for a positive integer n between 10 and 100 and then prints the sum of the integers that are evenly divisible by 4 or 6, but not both, from 1 to n. Input validation is required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Enter a positive integer between 10 and 100: 5 The number you entered is invalid. Try again. Enter a positive integer between 10 and 100: 20 The sum is 72. 8. Write a program that prompts the user to enter 3 integers and then prints the current average, displayed to 2 decimal places, of the numbers that were inputted at that time for each user input using a loop statement. Input validation is not required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Hint: Use printf("%.2f", num) to display num to 2 decimal places. Enter an integer number: 5 After 1 number(s), the average is 5.00. Enter an integer number: 6 After 2 number(s), the average is 5.50. Enter an integer number: 10 After 3 number(s), the average is 7.00.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Convert the decimal number (123.456)10 into the following indicated bases: (a) Binary number (b) Octal number (c) Hexadecimal number (1 Mark) Q2: Convert the decimal number 456 to binary in two ways:...
-
Suppose Nordic Boots was making production decisions for the following six boots: ot Price E(Demand) Std. Dev (Demand) Co Cu Exp. Profit Max. Profit A 220 1000 400 35.2 52.8 1101 39201 52800 230 2000...
-
A toroidal solenoid with 400 turns of wire and a mean radius of 6.0 cm carries a current of 0.25 A. The relative permeability of the core is 80. (a) What is the magnetic field in the core? (b) What...
-
Samples of size n = 5 are taken from a manufacturing process every hour. A quality characteristic is measured, and x and R are computed for each sample. After 2 samples have been analyzed, we have...
-
In July 2017, Latrice Merritt entered a residential lease with Doran 610 Apartments, LLC. Under the terms of the lease agreement, Merritt was prohibited from installing a private security system in...
-
Using the net worth method, analyze the financial data at the bottom of this page for potential signs of fraud or embezzlement: 1. Do your results indicate that this person could be committing some...
-
Scenario 17:Accountant 17 is the former manager of the audit dept. She says: when covid hit I decidedto retire. I was a cpa for 30 years but im no longer practicing, can I still call myself a cpa? Do...
-
December 1: , a new investor, made an investment in Byte by purchasing 2,700 shares of its common stock paying $72,900.00 in cash. The par value of the common stock was $19.00 per share. December 3:...
-
A team of engineering students is testing their newly designed 200 kg practices. The raft must hold a 730 kg steel cube with edges of length 45.0 cm density of water in the pool is 1000 kg/m raft in...
-
solve the following [(3 (3x5 - 5x) dx
-
Which two factors contributed to the stock market crash?
-
How do outcomes play out for factor owners when trade opens? (E.g. What happens to labor earnings for the labor-abundant country?) Address capital and labor income in both settings, when a given...
-
Y = Y f = 100 D = 10 +10 E ? P*/P + 0.4( Y?T ) + I+G I = 15 G = 30 T = 25 P* = 1.0 M d /P = 0.01 Y/R M S = 40 R* = 0.02 Calculate the long-run equilibrium price level ( P ) and the long-run...
-
Employment is a relationship between an employee and an employer with expectations by each that the responsibilities of the other will be fulfilled. Sometimes those expectations are not achieved,...
-
An embankment load on a silty clay soil layer as shown below. Determine the stress increase under the embankment at points A and B that are loaded at a depth of 6 m below the ground surface. 5 m...
-
How can NAFTA be beneficial to suppliers of Walmart?
-
Russell (age 50) and Linda (age 45) Long have brought you the following information regarding their income and expenses for the current year. Russell owns and operates a landscaping business called...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Frederick (Freddy) Freeweights (age 42) owns and operates a health club called ''Treadmills West.'' The business is located at 4321 Arnold Street, Alpine, CA 91901. Freddy had the following income...
-
Classify each of the following as either a policy instrument or an intermediary target. Explain your answer. a. Long-term interest rates b. Central bank interest rates c. M2 d. Reserve requirements
-
The New York Fed executes foreign exchange interventions for the Federal Reserve system. Go to https://www.newyorkfed.org/markets/quar_reports.html to see quarterly summaries of the Feds foreign...
-
The New Zealand dollar to U.S. dollar exchange rate is 1.38, and the British pound to U.S. dollar exchange rate is 0.65. If you find that the British pound to New Zealand dollar is trading at 0.5,...
Study smarter with the SolutionInn App