1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Umnica [9.8K]
3 years ago
6

Write a function called printEvens that prints all the even numbers between 2 and 20, inclusive. It will take no arguments and r

eturn nothing. You must also use a looping statement in the code to get credit for printing (i.e. no cout << 2 << " " << 4 " " << ...).
Computers and Technology
1 answer:
nataly862011 [7]3 years ago
3 0

Answer:

#include <iostream>

using namespace std;

void printEvens() {

   for (int i = 2; i <= 20; i++) {

       if (i % 2 == 0)

           cout << i << " ";

   }

}

int main() {

   printEvens();

   return 0;

}

Explanation:

- Inside the function, initialize a for loop that <u>goes from 2 to 20</u>.

- Inside the for loop, check if the <u>numbers are divisible by 2</u>. If yes, print the number

- Inside the main, call the function

You might be interested in
What are 5 good movies like The Breakfast Club or 8 Mile?
Gnoma [55]

Answer:

The Notebook, Beauty and the Beast, Step Brother, The Breakfast Club and The Little Mermaid

Explanation:

8 0
3 years ago
Read 2 more answers
How to start Microsoft acess​
Gennadij [26K]

Answer:

As with most Windows programs, Access can be executed by navigating the Start menu in the lower left-hand corner of the Windows Desktop. To start Access, click on the Start button, then the Programs menu, then move to the Microsoft Office menu and finally click on the Microsoft Access menu item.

7 0
3 years ago
How to cancel branly subscription??​
Vlad [161]

Answer:

cancel subscription

Explanation: website

3 0
4 years ago
Dairy Farm decided to ship milk in containers in the form of cubes rather than cylinders. Write a program called ws4.cpp that pr
Sonja [21]

Answer:

1. #include <iostream>

2. #include <cmath>

3.  

4. using namespace std;

5.  

6. int main()

7. {

8.     float radius;  

9.     cout << "Type the radius of the base: "; // Type a number

10.     cin >> radius ; // Get user input from the keyboard

11.      

12.     float height;  

13.     cout << "Type the height: "; // Type a number and press enter

14.     cin >> height; // Get user input from the keyboard

15.      

16.     float volumeCylinder = 3.1416 * radius * radius * height;

17.     float cubeSide = std::pow(volumeCylinder, 1/3.);

18.     cout<<"Cube side is: "<< cubeSide;

19.      

20.     return cubeSide;

21. }

Explanation:

  • From line 1 to 5 we include two libraries
  • From line 6 to 7 we declare our main function
  • From line 8 to 11 we ask the user for the radius of the cylinder
  • From line 12 to 15 we ask the user for the height of the cylinder
  • On line 16 we calculate the volume of the cylinder using the formula        V=pi*(r^2)*h
  • On line 17 we calculate the side of the cube with the same volume as the cylindrical container using the formula side=∛(V)
  • From line 18 to 21 we print and return the value of the cube's side  
Download cpp
3 0
3 years ago
A Queue can be used to implement a line in a store. If George, Judy, John, and Paula get in line and the cashier checks out two
Pie

Answer:

Explanation:

The following code is written in Java. It creates a Queue/Linked List that holds the names of each of the individuals in the question. Then it returns John and removes him and finally returns Paula and removes her.

package sample;

import java.util.*;

class GFG {

   public static void main(String args[])

   {

       Queue<String> pq = new LinkedList<>();

       pq.add("John");

       pq.add("Paula");

       pq.add("George");

       pq.add("Judy");

       System.out.println(pq.peek());

       pq.remove("John");

       System.out.println(pq.peek());

       pq.remove("Paula");

   }

}

3 0
3 years ago
Other questions:
  • You can deselect multiple selected sheets beginning with the sheet1 tab by pressing the ____ key and clicking the sheet1 tab.
    15·1 answer
  • Question 8 OT TU
    11·1 answer
  • How can I change it to accepted file types: .ppt, .pptx, .xls, .xlsx, .doc, .docx, .zip, .pdf, .accdb, .msg on Inkscape?
    15·2 answers
  • Some hardware can be added to the computer without having to restart or power down the computer. After a short period of time th
    5·1 answer
  • Write a statement that declares an int variable named count.
    9·1 answer
  • What includes two or more private, public, or community clouds, but each cloud remains separate and is only linked by technology
    11·1 answer
  • Analyze the following recursive method and indicate which of the following will be true.
    7·1 answer
  • Why is it important to use fillings,coating/icing,glazes or decorations for pastry products​
    14·1 answer
  • does anyone know the what the tuition fee is for UC Berkeley PER YEAR. My smooth brain can't find it ANYWHERE.
    10·2 answers
  • Prepare the truth table for the following boolean expressions: (A+B).(A+C).(B)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!