ssesi ent takeitakejsp7course assessment id,111332S_1&coursed.SM930.ico; eedd,34
ID: 3903718 • Letter: S
Question
ssesi ent takeitakejsp7course assessment id,111332S_1&coursed.SM930.ico; eedd,340 e anch Suppose we have the following artays storing the states of the computers in the Srit and second rows of our classroom The boolean varable indcaes whetr each bool conputern row[s)- rse,teue, false, Ealse, Eslbela Which code will tabulate the total number of computers that are cumently tumed on? O int totalon-01 sted cuny s tuned or it (computeron_rou2t13) O ist totalon-0: tor tant 1-0 1floomputeron rowit?1) O int totaion - if loomputeron zow2(4 ly sends some data to Mobile so that we can improve your epeience e web and Windows 6Explanation / Answer
The code
int totalOn=0;
for(int i=0;i<5;i++)
{
if(computerOn_row1[i])
totalOn++;
if(computerOn_row2[i])
totalOn++;
}
will count the total number of computers that are turned on as it checks in both the rows, i.e both the arrays for true values.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.