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
Microsoft Paint can be described as a digital sketch pad ?
alexira [117]
Yes I can be be a digital sketch pad

HOPE THIS HELPS!!!!!!!
4 0
3 years ago
The shortcut key combination to cut text is. Ctrl+C Ctrl+X Shift+V Shift+Y​
Gemiola [76]

Answer:

Ctrl + X

Explanation:

5 0
4 years ago
Read 2 more answers
Farm equipment that travels on public roads
solmaris [256]
I've seen tractors on the roads... if that's what you're looking for.
7 0
4 years ago
Read 2 more answers
Difference between rainbow six siege starter edition and regular
Svetradugi [14.3K]
Regular means all operators charms etc cost normal price, but the Starter edition increases the price for all of those things but it is cheaper then the reg version
8 0
4 years ago
Home
Papessa [141]

Answer:

Enables online download of music

Enables reading while exercising

Reduces the need for printing

Enables sending documents to multiple recipients

Provides savings on travel expenses by supporting virtual meetings

Provides flexible work schedules and environments

Explanation:

7 0
4 years ago
Other questions:
  • Read the paragraph.
    12·2 answers
  • What happens if you never confirm your facebook account?
    8·1 answer
  • 1.which of the following CANNOT be copyrighted?
    7·1 answer
  • Integrity is keeping data consistent and free of errors or anomaliea<br> True or false
    7·1 answer
  • Why do we need IP Addresses in order for the Internet to function properly?
    7·1 answer
  • In most programming languages, the compiler carries a preprocessing step to determine if certain statements will compile. For in
    7·1 answer
  • Is the internet a private place?
    15·2 answers
  • Why a commerce student must learn about SDLC (Software Development Life Cycle) and its phases?
    12·1 answer
  • Httpsdiscord.ggBVNuFMgG link is here<br>come and join discord​
    13·1 answer
  • What is the difference between DWT and CWT?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!