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
Firlakuza [10]
3 years ago
15

Write a c++ program to print even numbers from 1 to 20​

Computers and Technology
1 answer:
Novay_Z [31]3 years ago
8 0

Answer:

#include <bits/stdc++.h>

using namespace std;

// Function to print even numbers

void printEvenNumbers(int N)

{

cout << "Even: ";

for (int i = 1; i <= 2 * N; i++) {

// Numbers that are divisible by 2

if (i % 2 == 0)

cout << i << " ";

}

}

// Function to print odd numbers

void printOddNumbers(int N)

{

cout << "\nOdd: ";

for (int i = 1; i <= 2 * N; i++) {

// Numbers that are not divisible by 2

if (i % 2 != 0)

cout << i << " ";

}

}

// Driver code

int main()

{

int N = 20;

printEvenNumbers(N);

printOddNumbers(N);

return 0;

}

Explanation:

Note: This will find both odd and even numbers, you have to change the number above to the number of your choice

For even numbers

Even number are numbers that are divisible by 2.

To print even numbers from 1 to N, traverse each number from 1.

Check if these numbers are divisible by 2.

If true, print that number.

For odd numbers

Odd number are numbers that are not divisible by 2.

To print Odd numbers from 1 to N, traverse each number from 1.

Check if these numbers are not divisible by 2.

If true, print that number

You might be interested in
In a virtual memory system, each process must have its own page table.(True or False?)
Anna71 [15]

Answer: True

Explanation:

 Virtual memory is the secondary storage memory and this type of memory are addressed as main part of the memory.

When the virtual memory copying in the physical memory then, at that time the operating system divide the memory into the file page with the address and definite size number. Then, the each page are store in a disk.

When this page are required then, the operating system copy from disk to main memory and then, the virtual address are converted into the  real address.

6 0
3 years ago
____ is a form of software that includes a wide range of built-in functions for statistical, financial, logical, database, graph
Alex17521 [72]

Answer:

The answer is: Spreadsheet

3 0
3 years ago
To erase an entire entry in an excel cell and then reenter the data from the beginning, press the ____ key.
AVprozaik [17]
To erase an entire entry in an excel cell and then reenter the data from the beginning, press the ESC key. ESC stands for <span>Escape.
</span>The escape key is found <span>on most computer keyboards.  When the ESC key is presses t</span>hen the escape command is sent from the keyboard to a computer and this command o is interpreted by software as "stop". So, it is used to stop some actions.
5 0
3 years ago
A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only
Advocard [28]

Answer:

I need some time i answering your question please follow me and thank(sanybody have any friends cute girl or cute sardarni he is my classmate His name Was Kushi ask to Please follow me)

4 0
2 years ago
You create a computer-aided design database that stores data including a list of components of an item being designed, the relat
Leviafan [203]

Answer:

The correct answer is Multi-dimensional.

Explanation:

This database is optimized for online analytical processing and data warehousing (OLAP) applications. Multidimensional databases are often created using existing relational database records. While a relational database can be accessed through a Structured Query Language (SQL) query, a multi-dimensional database allows the user to ask questions like: "How many additives were sold in Nebraska in a year?" and similar issues related to the synthesis of operations and business trends. An OLAP application that accesses data from a multidimensional database is called a MOLAP application (Multidimensional OLAP).

3 0
3 years ago
Other questions:
  • (011001111)2=(?)10 can anyone solve this urgent <br><br> Hurry
    11·2 answers
  • The chart shows an example of a study-time survey. Students can use the formula shown in the survey to figure out ways to track
    14·1 answer
  • Wich is the correct process for selecting an entire row in a spreadsheet?
    12·1 answer
  • A network administrator notices that some newly installed Ethernet cabling is carrying corrupt and distorted data signals. The n
    5·1 answer
  • PLEASE HELP!
    14·2 answers
  • What is ransomware<br>я​
    5·1 answer
  • Which ribbon tab is not a default in Outlook 2016's main interface?
    13·2 answers
  • What are your two biggest strengths as a student? How will these strengths help you become a self-directed learner?
    13·2 answers
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • In the bremmer article, the author states that _________ translates into greater risks.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!