Computer Science, asked by negikiran179, 5 months ago

Write the output of the following program code int p=0, i =1; while(i<=5) { System.out.print(i+" "); p=p+i; i++; }​

Answers

Answered by Ompravassahoo
0

Answer:

please mark my answer as brainliest

Explanation:

Consider the following code snippet:

arrayOfInts[j] > arrayOfInts[j+1]

Question: What operators does the code contain?

Answer: >, +

Consider the following code snippet:

int i = 10;

int n = i++%5;

Question: What are the values of i and n after the code is executed?

Answer: i is 11, and n is 0.

Question: What are the final values of i and n if instead of using the postfix increment operator (i++), you use the prefix version (++i))?

Answer: i is 11, and n is 1.

Question: To invert the value of a boolean, which operator would you use?

Answer: The logical complement operator "!".

Question: Which operator is used to compare two values, = or == ?

Answer: The == operator is used for comparison, and = is used for assignment.

Question: Explain the following code sample: result = someCondition ? value1 : value2;

Answer: This code should be read as: "If someCondition is true, assign the value of value1 to result. Otherwise, assign the value of value2 to result."

Similar questions