![lilpeepxliltracy](/avatars/42820.jpg)
lilpeepxliltracy
06.05.2020 •
Computers and Technology
Given the following code:
if (n==2)
{
k-= 2;
}
else if (n==3)
{
k-=3;
}
can be rewritten as if ()
{
;
}
where < condition > and < assignment statement > are chosen so that the rewritten code performs the same task as the original code. Assume that both n and k are integer variables. Which of the following could be used as < condition >?
I. (n == 2) || (n == 3)
II. (n == 2) && (n == 3)
III. (n >= 2) && (n <= 3)
a. 1 only
b. 2 only
c. 3 only
d. 1 and 3 only
e. 2 and 3 only
Solved
Show answers
More tips
- F Food and Cooking 10 Ideas for a Wedding Anniversary Gift...
- H Health and Medicine Hangover: How to Get Rid of It Quickly?...
- S Style and Beauty How to Choose the Right Fur Coat and Avoid Regrets?...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- A Arts Saw sum1 do this-fr im jus bored XD...
- M Mathematics Which equation is part of solving the system by substitution? x+y=11 4x² – 3y = 8...
- G Geography Today, Japan is considered a decreasingly developed country. developing country. moderately developed country. highly developed country....
- M Mathematics What is a down payment...
- A Arts Let me borrow 20 manga s...
- M Mathematics What are some advantages to multiplying instead of adding fraction...
- M Mathematics Which expression is equivalent to 2a – 3b – 4b + 4a + 17?...
- M Mathematics It rained 4/5 of inch each day last week.how many total inches fell durning the week?...
- P Physics Which segment of government is responsible for proposing federal government spending...
- M Mathematics The figure above shows the solution to a compound inequality. Which inequality does the solution show? A) –2 x – 5 ≤ 6 B) –2 ≤ x + 5 6 C) –2 x + 5 ≤ 6 D) –2 ≤ x –...
Ответ:
a. 1 only ie
I. (n == 2) || (n == 3)
Explanation:
An integer is a number that can be written without a fractional component. For example, 21, 4, 0, and −2048 are integers, while 9.75, 5+, and √2 are not. The set of integers consists of zero, the positive natural numbers, also called whole numbers or counting numbers, and their additive inverses.
The answer is I. (n == 2) || (n == 3)
Ответ:
The best answer choice is Choice B, or the second option.
Hope this helps, let me know if you need anything else. :)