a. Write a function countDivisibleBy6() that takes as parameters two integers (nl and n2) and returns...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a. Write a function countDivisibleBy6() that takes as parameters two integers (nl and n2) and returns how many numbers are divisible by 6 between n1 and n2 (n2 should be greater than n1; if n2 is less than n1, the function returns -1). Write the prototype and the definition of the function. b. Write a C++ program that asks the user to enter two integers and uses the function countDivisibleBy6() to print on the screen how many numbers are divisible by 6 between nl and n2. Sample run: Please enter two integers: 1 32 4 numbers are divisible by 6 between 1 and 32 a. Write a function countDivisibleBy6() that takes as parameters two integers (nl and n2) and returns how many numbers are divisible by 6 between n1 and n2 (n2 should be greater than n1; if n2 is less than n1, the function returns -1). Write the prototype and the definition of the function. b. Write a C++ program that asks the user to enter two integers and uses the function countDivisibleBy6() to print on the screen how many numbers are divisible by 6 between nl and n2. Sample run: Please enter two integers: 1 32 4 numbers are divisible by 6 between 1 and 32
Expert Answer:
Answer rating: 100% (QA)
Below is the C code with the function countDivisibleBy6 and a simple pr... View the full answer
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
1) What are the implications of CICs approach to staffing project teams? Is the company using them as training grounds for talented fast-trackers or as dumping grounds for poor performers? 2) How...
-
Suppose the spot rates for 1 and 2 years are s1 = 6.3% and s2 = 6.9% with annual compounding. Recall that in this course interest rates are always quoted on an annual basis unless otherwise...
-
Huang Industries is considering a proposed project whose estimated NPV is $12 million. This estimate assumes that economic conditions will be average. However, the CFO realizes that conditions could...
-
In Figure P29.40, \(R=0.12 \mathrm{~m}\) and a changing magnetic field creates an electric field that has magnitude \(E=10 \mathrm{~V} / \mathrm{m}\) at a radial distance \(r=0.060 \mathrm{~m}\) from...
-
Douglas Corporation had 120,000 shares of stock outstanding on January 1, 2010. On May 1, 2010, Douglas issued 60,000 shares. On July 1, Douglas purchased 10,000 treasury shares, which were reissued...
-
a) Money markets are used to trade debt securities and instruments with maturities of less than one year. Identify three characteristics of the money market. (6 marks) b) Explain four reasons for the...
-
At which level of the product do features like product support, warranties, after-sales service, and delivery and credit come into play, enhancing the product's value and differentiating it from...
-
A person borrows $4000 at (4) = 6%. He promises to pay $1000 at the end of one year, $2000 at the end of 2 years, and the balance at the end of 3 years. What will the final payment be?
-
The strike price of an American call option on a stock is 29. The stock currently sells for 30 and in one year will be worth either 33 or 27. (a) Calculate the value of the call option with a...
-
Rudolf Supplies is a seasonal gift business that makes most of its sales between October and December. The company approaches you in June to discuss financing for the purchase of inventory and...
-
A horizontal 745 N merry-go-round of radius 1.76 m is started from rest by a constant horizontal force of 65.2 N applied tangentially to the merry-go-round. Find the kinetic energy of the merry-go-...
-
Consider a charged parallel-plate capacitor. How can its capacitance be halved? Check all that apply. Double the charge. Double the plate area. Double the plate separation. O Halve the charge. Halve...
-
11. Equation of motion of a damped harmonic oscillator in general form is: a) i = - w?z b) i = w? c) 2 = -(w + w?z) d) i = w + w?z 12. Quality factor (Q) of a RLC circuit with L = 1.0 x 10-2H, C =...
-
If the cylinder described in Problem 21.3 were initially heated to 500F, how long would it take for the center of the cylinder to cool to 240F if it were constructed of a. Copper? b. Brass? c. Nickel?
-
Add an equals method to the TimeSpan class introduced in Chapter 8. Two time spans are considered equal if they represent the same number of hours and minutes.
-
The following code does not compile. Why not? What is upsetting the compiler? int a = 10; %3D int b = 20; int sum = IntStream.of (1, 2, 3, 4, 5) . map (n -> n + b - (++a)) sum () ;
-
Write a method called printAcronym that accepts a string as its parameter and prints the first letter of each word of the string as an acronym. For example, the call of printAcronym("Breath of the...
-
Using what you learned in this chapter of Dessler Human Resource Management, build on the companys new system by recommending two more specific career development activities the hotel should...
-
Many hotel jobs are inherently dead end; for example, maids, laundry workers, and valets, either have no great aspirations to move up, or are just using these jobs temporarily, for instance, to help...
-
Is there another incentive plan you think would work better for the pressers? Describe it.
Study smarter with the SolutionInn App