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
sp2606 [1]
3 years ago
11

What is wrong with the following if statement (there are at least 3 errors).

Computers and Technology
1 answer:
Gwar [14]3 years ago
7 0

In programming, if statements are used to test conditions. The statement to be executed will be determined by the result of the conditions. A statement will be executed if its accompanying condition is true.

The errors in the given code segment are as follows:

  1. The if condition on line 1 should be in a closed bracket; i.e. ()
  2. The if condition has more than 1 statements to execute. So, it requires a curly bracket; i.e. {}
  3. The second part of the first condition should be == 4 and not =4; because the proper operator to make comparison is == while = is used as an assignment operator

The correct code is as follows:

<em>if (numNeighbors >= 3 || numNeighbors == 4) { </em>

<em>++numNeighbors; </em>

<em>printf ("You are dead! \n “); } </em>

<em>else </em>

<em>--numNeighbors;</em>

<em />

Read more about conditional statements at:<em> </em>

brainly.com/question/20228453

You might be interested in
Which science topics would be suited for this organizational aid? Check all that apply.
IrinaVladis [17]

Answer:

Its A and E

Explanation:

3 0
3 years ago
Pls help is very urgent and I will mark u as brainliest plsssss​
elena-s [515]

Answer:

this is the method of processing wood

5 0
3 years ago
Read 2 more answers
Simplify the Boolean expression (AB(C + BD) + AB]CD.
finlep [7]

Explanation:

Simplify the Boolean expression (AB(C + BD) + AB]CD.

6 0
3 years ago
Read 2 more answers
Angelina wants her text to look less crowded on the page, so she decides to decrease the length of the space the text occupies.
ratelena [41]

Answer:

She can go to the Layout tab and then to the Page setup command group to increase the margins of the page.

Explanation:

Because margin decides from the text should start ie. it decides how much space should be left on the top of the page, bottom, left and right. If you increase the margin automatically the amount of space in all the four sides gets increased and hence the contents gets automatically adjusted and the text will look better readable than before.

The crowd that it has created before automatically gets adjusted and will give a better look.

8 0
4 years ago
Read 2 more answers
Which of the following assessments uses computer-adaptive technology to provide questions? SAT, ACT, ASVAB, or ACCUPLACER?
never [62]
ACCUPLACER, I hope this helps :)
7 0
4 years ago
Read 2 more answers
Other questions:
  • What is required for real-time surveillance of a suspects computer activity?/p Group of answer choices a. Blocking data transmis
    12·1 answer
  • What type of analysis should be used to respond to the statement, "Let's cut advertising by $1000 repeatedly so we can see its r
    14·1 answer
  • Suppose that the tuition for a university is $10,000 this year and increases 4% every year. In one year, the tuition will be $10
    10·1 answer
  • What is meant by check digit
    10·1 answer
  • Of the various trends affecting the advertising and promotion industry, _____________ offers an opportunity for advertisers to d
    9·1 answer
  • Which of the following “invisible” marks represents an inserted tab?
    11·2 answers
  • Design a program that asks the user to enter a string containing a series of single digit numbers with nothing separating them.
    7·1 answer
  • 4.5 code practice computer science
    5·1 answer
  • Assume that you have the business data in various sources such as Excel, .csv, text files and Access, Oracle databases. Write th
    9·1 answer
  • Debra tracks her business finances in a spreadsheet. She wants to figure out how much she could increase profits if she raises p
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!