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
laiz [17]
3 years ago
7

Int a = 1; int b = 0; int c = -1; if ((b + 1) == a) { b++; c += b; } if (c == a) { a--; b = 4; }

Computers and Technology
1 answer:
dimulka [17.4K]3 years ago
8 0

Answer:

a = 1

b = 1

c = 0

Explanation:

Given

The above code segment

Required

The final values of a,\ b\ \&\ c

The following line declares and initializes the values of a, b and c

int a = 1;     int b = 0;     int c = -1;

So, we have:

a = 1; b =0; c = -1

Next, the following if condition is tested

if ((b + 1) == a)

b + 1 =0 +1

b + 1 = 1

And:

a = 1

So,

b + 1 = a = 1

Since the condition is true, the statements in the curly brace { } will be executed;

b++ \to b = b+1 \to b = 0 + 1 \to b = 1

So:

b = 1

c += b \to c = c+b \to c = -1 + 1 \to c = 0

So:

c = 0

Next, the following if condition is tested

c == a

c = 0 and a =1

So:

c \ne a

That means, the statements in its curly brace will not be executed.

So, the final values of a, b and c are:

a = 1

b = 1

c = 0

You might be interested in
The algorithm for solving the problem of average of five (5) numbers​
PilotLPTM [1.2K]

Answer:

Explanation:

Denote the five numbers as a, b, c, d and e.

The average is:

(a + b + c + d +e) ÷ 5.

Easily:

Learn how to do input and output operations in your programming language of choice.

Learn what average is (see Arithmetic mean - Wikipedia)

Learn how to code arithmetic operations in your PL of choice.

Put all that together and code the program.

Oh, did you expect the code snippet? Sorry, I don’t do peoples’ homework for them on principle. Homework is for you to learn something. If you can’t be bothered, accept that you’ll fail your class. If you want to pass, LEARN.

3 0
2 years ago
How do you recognize substances that have gone through physical or chemical changes?
Leviafan [203]
Normally  you can't.   You cannot tell if water has been frozen and then thawed.
7 0
3 years ago
Read 2 more answers
How are sorting tools helpful for using spreadsheets and databases? Sorting tools let you locate information by searching for na
Black_prince [1.1K]

Answer:

Sorting tools allow you to organize data into columns and rows that help you locate what you are looking for.

Explanation:

Spreadsheet applications and relational databases are similar in configuration as they are both arranged in rows and columns (tabular). Sorting a spreadsheet or database is useful as it helps to organize data. A sorted spreadsheet or database can be in ascending or descending order which makes it easier and faster to locate rows of data manually or by query.

7 0
2 years ago
Read 2 more answers
How do I convince my mom to buy a gaming computer for me? She says we already have 3 other computers/laptops in the house to use
Natalka [10]

Answer: ??

Explanation: explain to her that you don't have your own. keep asking and convince her you're doing good in school, (if u are) and that you listen and you should be responsible to have your own

4 0
2 years ago
what's that one game where you have powers like telekenesis, it's also an open world GTA type of game
torisob [31]
Is it infamous for the playstation 3?
4 0
3 years ago
Read 2 more answers
Other questions:
  • Consider the following sequence, defined from n=2 to 15 (inclusive). Pn=n2−1. Produce a list named primes which only contains va
    10·1 answer
  • Derek found that the CPU was running several processes. While Derek was looking at Task Manager, the computer crashed. Derek res
    15·2 answers
  • Write the UPDATE command to increase the commission (column name :COMM) by 500 of all the salesman who have achieved sales (Colu
    15·1 answer
  • Name three types of data stored on a computer’s hard disk
    11·1 answer
  • What is my favorite color?<br> Red<br>Orange<br>Yellow<br>Blue <br>Gold<br>Silver
    13·1 answer
  • How many bytes are there in 256 Kbytes?
    6·1 answer
  • The exploitation of a buffer-overrun vulnerability in an application will MOST likely lead to:_________
    15·1 answer
  • Select the correct answer. Which is the bottom-most layer in the OSI model?
    9·1 answer
  • Identify when programmers use an Else statement.
    15·2 answers
  • Kaitlin likes a particular design theme, but she is not sure about every single color for bullets, backgrounds, etc. found in th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!