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
On a rheostat the first terminal is connected to a
Morgarella [4.7K]
On a rheostat the first terminal is connected to a
A ground return path
fined contact
Ceramic heat sink
Bbbbncnennanxkcndkfnrnenwn77819’cjchopeithlps they
5 0
3 years ago
Which option is the default when creating appointments and meetings in a user’s own calendar as it relates to Free/Busy informat
Vlad1618 [11]

Answer:

C !

Explanation:

7 0
3 years ago
Leo needs to consolidate data in multiple worksheets by performing a calculation across all worksheets on the same cells.
wolverine [178]
A do you think is the answer
4 0
3 years ago
Read 2 more answers
17.
Radda [10]
Sorry to answer you so late but that would be truth because that is the first rule of science which is what thermodynamics depends in. 

The first law of thermodynamics is a type of law of conservation but with thermodynamics systems. 


So, in gogle I found this: "The law of conservation of energy states that the total energy of an isolated system is constant; energy can be transformed from one form to another, but cannot be created or destroyed."

Like I said, sorry to reply so late but I hope this helped! =)
3 0
3 years ago
Differences between windows xp and windows vista
krek1111 [17]
Well since Windows XP runs on Windows 2000 technology,it would be "slow".Also that Windows XP had MSN,which expired 15 years ago,but the good thing about Windows XP is that it can connect to the internet via WiFi without the computers hardware used for WiFi(PC only).Also that Windows XP has a logo on the start-up screen.Windows Vista on the other hand, doesn't have a logo on the start-up screen,but shows a Windows Vista animated logo atfer the start-up screen.Also that some people named Windows Vista "The first Windows 7".But somewhat,Windows Vista ran faster than Windows XP at starting up.Windows Vista was old,but it sold better than Windows XP.
6 0
3 years ago
Other questions:
  • Your neighbor has moved to another country. He informs you about his new job. You wantto congratulate him by sending an e-mail m
    13·1 answer
  • You are configuring IP settings on a new network. For the external interfaces, you decide to obtain registered IP addresses from
    5·1 answer
  • A web application is an example of:
    7·1 answer
  • Could someone please explain to me the an electrical circuit.
    13·2 answers
  • In C!!
    11·1 answer
  • hey guys just dropped some hot beats so go and follow me my user is the beats and comment if you would do that that would be gra
    11·1 answer
  • Create a dictionary that maps a fruit name to its color. Both the keys and the values should be stored as strings. Include only
    7·1 answer
  • 2.2 Write an interactive C# program that asks the user to input an integer number. The program checks whether the number entered
    10·1 answer
  • Fill in the blank: _____ data are statistical and numerical facts about a project.
    15·2 answers
  • What happened to the ten commandments tablets.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!