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
A palindrome is a string that reads the same both forward and backward. For example, the string madam is a palindrome. Write a p
miskamm [114]

Answer:

Explanation: Hey bro! Sorry to bother. But have any of your questions got deleted after posting them? I don't know why my question got deleted by a guy.

8 0
3 years ago
Casey, a woodworker, is developing his own website. He plans to use the site as a means of selling his handmade furniture. While
dybincka [34]

Answer:

Primary information

Explanation:

There are three types of information, they are; primary, secondary and tertiary information.

Primary information is called direct sources of information since they are gotten from originally written materials like research journals, diaries, poems, surveys, interviews, etc.

Secondary information like textbooks, encyclopedias, dictionaries, and book reviews describes and analyzes primary information.

Tertiary information is a platform that holds both the primary and secondary information.

6 0
3 years ago
When might be the best time to start saving for retirement?
Nata [24]

Answer

At the earliest possible date.

Explanation

Retirement is the act of leaving your job and stopping working, usually because you are old: Your retirement benefit is based on your highest years of earnings and savings and your age when you start receiving benefits. consistently saving a little money for retirement at the earliest possible date.is much better than saving a lot more money when you are in your fifties.

4 0
3 years ago
Read 2 more answers
SMART PEOPLE NEEDED
mario62 [17]
D doesn't make much sense, it's valid, but not what we're looking for. B also has a correlation with D, same reasoning applies. As for A, it seems pretty legit, but I don't believe that's what we're looking for.

Choice C is the most obvious one though. We're talking about a network and as may or may not know it's a wireless one in a manner of speaking. A <span>couple of computers in the network that have trouble maintaining a signal will indefinitely lead to failure of a network since both the links and nodes of certain computer systems are incapable of maintaining a signal. </span>
6 0
3 years ago
How do you implement instruction level parallelism
netineya [11]

Answer:

To obtain substantial performance enhancements, we must exploit ILP across multiple basic blocks.

Explanation:

8 0
3 years ago
Other questions:
  • A software program that enables users to find and display information stored as html pages on the internet is a(n) ____.
    5·1 answer
  • All of the following are vertical alignment options except __middle , top, center, or_bottom_.
    12·1 answer
  • Which of the following about if statement is true? A. The condition is a Boolean expression B. A Boolean expression is something
    15·1 answer
  • This is the thing that I don't understand why did they banned private chat like there are long-distance relationships, and frien
    13·2 answers
  • What is the difference between a design pattern and a DLL?
    12·1 answer
  • To more easily incorporate methods into a program, it is common practice to store methods in their own classes and files. Then y
    6·1 answer
  • What code do I have to use in my php if i don’t want my $_SESSION[“variablex”] to destroy? But i already have a session_destroy(
    6·1 answer
  • A software update is also referred to as what?
    15·2 answers
  • Hy plzz help me friends​
    5·2 answers
  • In windows 10, where would you save the template so it is available in the available templates list in backstage view?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!