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
Arlecino [84]
3 years ago
14

Show the exact output of the following codesegments:(a) for(x=0; x<20; x=x+2)cout<< x << ‘ ‘;cout<< endl ;(

b) i=10;for (;i>0; i =i/2;)cout<< i;
Computers and Technology
1 answer:
egoroff_w [7]3 years ago
3 0

Answer:

a)

for(x=0;x<20;x=x+2)

cout<< x << ' ';

cout<< endl ;

<u>Output</u>

0 2 4 6 8 10 12 14 16 18

In this code we are initialing x with 0, check if it is less than 20, then printing the value 0.

Then we increment x value with 2 and check and print again until the x value tends to be equal or more than 20.

<u>C++ program for verifying</u>

#include <iostream>

using namespace std;

int main()

{

   int x;

   for( x=0;x<20;x=x+2)

      cout<< x << ' ';

      cout<< endl ;

   return 0;

}

<u>Output</u>

0 2 4 6 8 10 12 14 16 18

(You can check on any ide for confirmation)

b)

i=10;

for (;i>0; i =i/2;)

cout<< i;

This code will produce error expected ‘)’ before ‘;’ token

  for(;i>0; i =i/2;)

because for loop consist three parameters and in this loop there are 4 parameters.

If we remove semicolon after i/2,

for(;i>0; i =i/2)

then it will produce an output.

10 5 2 1

<u>C++ program for verifying</u>

#include <iostream>

using namespace std;

int main() {

int i=10;

 for(;i>0; i =i/2;)

 cout<< i;

return 0;

}

<u>Output</u>

Error-expected ‘)’ before ‘;’ token

  for(;i>0; i =i/2;)

You might be interested in
Setting financial priorities and goals will help you save money for future needs <br> True or false?
allsm [11]
Hey there!

Here is your answer:

<u><em>The proper answer to this question is option A "true".</em></u>

Reason:

<u><em>Financial priorities, and goals would help make a person more money. Goals would include: Opening bank accounts, adding money to some sort of fund, or putting money into a bank account.</em></u>

<em>Therefore the answer is option A!</em>

If you need anymore help feel free to ask me!

Hope this helps!

~Nonportrit 
3 0
3 years ago
If you were the manager at a firm which deals with sensitive information of its customers, employees and other stake holders, ho
Rzqust [24]

Answer:

explanation below

Explanation:

Management controls are some of the techniques and mechanisms that can be put in place to implement security policies – which ensure information and information systems are protected.  These controls are not only used by managers but can be exercised by selected users.  

These controls must be put in place to cover all forms of information security, physical security and classification of those information.  

5 0
3 years ago
Series-connected 11-pF and 21-pF capacitors are placed in parallel with series-connected 22- pF and 30-pF capacitors. Determine
Naya [18.7K]

Answer:

19.9 pF

Explanation:

Given that:

Series connection :

11pF and 21pF

C1 = 11pF ; C2 = 21pF

Cseries = (C1*C2)/ C1 + C2

Cseries = (11 * 21) / (11 + 21)

Cseries = 7.21875 pF

C1 = 22pF ; C2 = 30pF

Cseries = (C1*C2)/ C1 + C2

Cseries = (22 * 30) / (22 + 30)

Cseries = 12.6923 pF

Equivalent capacitance is in parallel, thus,

7.21875pF + 12.6923 pF = 19.91105 pF

= 19.9 pF

8 0
3 years ago
Drag the tiles to the correct boxes to complete the pairs.
Mice21 [21]

Answer:

Operation open purpose

8 0
3 years ago
Read 2 more answers
Which is better computer science or software engineering?
mina [271]

you have to be extremely talented to be a software engineer so I see that as way more complex and cool.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which troubleshooting tool enables you to connect to a user's remote computer, view and interact with the user's screen, and cha
    8·1 answer
  • A computer network is a collection of _____.
    13·2 answers
  • An intranet is a way for a company or organization to protect copyrighted and other important information?
    15·2 answers
  • When you use the Filter feature, what appears in each column label
    11·1 answer
  • What color is the smartart tolls tab?
    5·1 answer
  • A mobile device user has tried to install a new app numerous times without success. She hasclosed all unused apps, disabled live
    12·1 answer
  • Why does dew form on grass overnight
    7·1 answer
  • Which of these are tools used to diagnose and test code? Check all of the boxes that apply.
    9·1 answer
  • What security weaknesses/vulnerabilities exist in Wireless local area network device hardware and software?
    10·1 answer
  • What safety do you need to have ready to start a device repair?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!