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
RideAnS [48]
3 years ago
9

Write a for loop that will print the values 1 to 20 while skipping the odd numbers (2,4,6,8,10,12,14,16,18,20):

Computers and Technology
1 answer:
DochEvi [55]3 years ago
6 0

<u>Answer:</u>

<em>void main ( )  </em>

<em> {  </em>

<em> int counter;  </em>

<em>  cout<<""Even numbers between 1 to 20 are:""<<endl ;  </em>

<em> //Method 1 </em>

<em>  for (counter = 1; counter <= 20; counter++)  </em>

<em>  {  </em>

<em>    if ( counter%2 == 0)  </em>

<em>   {   </em>

<em>     cout<<counter<<""\t""<<endl ;  </em>

<em>   }  </em>

<em>  }  </em>

<em>//Method 2 – simplest one </em>

<em>for (counter = 2; counter <= 20;)  </em>

<em>  {  </em>

<em>     cout<<counter<<""\t""<<endl ;  </em>

<em>counter = counter + 2; </em>

<em>    </em>

<em>  } </em>

<em> </em>

<em>  return 0;  </em>

<em>} </em>

<u>Explanation:</u>

In this, Method 1 runs a for loop and check whether each number is divided by 2. If yes, then printed otherwise it is skipped.

In the second method, it runs for loop only for even numbers. <em>This is obtained by incrementing the counter by 2. </em>

You might be interested in
Variables defined inside a member function of a class have: Block scope. Class or block scope, depending on whether the binary s
Snowcat [4.5K]

Answer:

The answer is "Block scope".

Explanation:

In the programming, the scope is a code, in which it provides the variable ability to exist and not be retrieved beyond variable. In this, the variables could be defined in 3 locations, that can be described as follows:

  • Inside a method or the block, which is also known as a local variable.
  • Outside of the method scope, which is also known as a global variable.
  • Defining parameters for functions known as formal parameters.
8 0
4 years ago
Type the correct answer in the box. Spell all words correctly.
Ugo [173]

Answer:

Business format franchise or Business Brokers

Explanation:

8 0
3 years ago
Define the following <br>chatting <br>browsing <br>E-commerce​
vova2212 [387]

Answer:

- <em>chatting</em>: real-time communication via keyboard between two or more users on a local network (LAN) or over the Internet.

- <em>browsing</em>: refers to reading and scanning through data; commonly used to describe when a user reads through pages on the Internet and is also often referred to as surfing.

- <em>e-commerce</em>: commercial transactions conducted electronically on the internet.

5 0
3 years ago
When using VLOOKUP we can search for information from more than one spreadsheet. <br> True or False
Pepsi [2]

heyy man it's true for sure

7 0
3 years ago
Consider a situation where we have a file shared between many people.  If one of the people tries editing the file, no other pe
Sergeu [11.5K]

Explanation:

I am a collection of this process from Trash on the computer system and the program that included a new twist on the computer and the skin that appears after loading and the Windows operating system it was much that appear on identifying long horizontal bar at the bottom of the screen and water pollution and its control car parts of the computer with enough letters and adware if for the collection of the fat calculation in the complete committee that in the water method is a product of a screensaver been disciplined displayed at the subject of the right click an icon To Number Sau new file getting opened on you can getting opened on a forgiving of an operational effectiveness of the program is a false false false

7 0
3 years ago
Other questions:
  • f the copyright date on the homepage is more than 1 year old, the website should always be considered unmaintained
    8·1 answer
  • Using the _______ list, you can select the number of photos that will appear on each slide.
    10·2 answers
  • Write a program named ArrayDemo that stores an array of 10 integers. (Note that the array is created for you and does not need t
    14·1 answer
  • What are the overheads associated with recursive algorithms? [
    9·1 answer
  • Which of the following answers refers to a system containing mappings of domain names to various types of data, such as numerica
    15·1 answer
  • Which of these is not an application software?
    6·2 answers
  • 1. Pasar los siguientes ejercicios a diagrama de bloque
    11·1 answer
  • describe at least five ways in which information technology can help studying subjects other than computing​
    6·1 answer
  • Who used the term" software" first?
    8·2 answers
  • 9. Which of the following will best protect your computer from viruses and hackers?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!