The three loop structures in C are: do/while, while, for do/for, do/while, while
ID: 3858646 • Letter: T
Question
The three loop structures in C are: do/while, while, for do/for, do/while, while while/for, while/do, for/do while/do, while, for What is the format for the first line of a for() loop in C? for (expression 1 expression 2 expression 3) for (expression 1: expression 2: espression3) for (expression 1: expression2, expression3) What is the value of count after the following nested for loops are executed? int k, j, count = 0 for(k = -1;k = 1: j-) count ++: 10 5 15 0 Which variable is the loop control variable in the following code? double accel = -9.81, velo = 15, alt = 0.0, time = 0.0: { int count: count = 0: if(a > =0.0) count - count + 1: if(b > =0.0) count = count + 1: if(c > =0.0) count = count+1: return count: } 2 3 1 0Explanation / Answer
Solutions
1. the three loops are option (a) Do/while,while,for
three loop structures are there in programming they are Do/while loop, while loop and for loop. loop structures are used to repeat a block of statements until the condition becomes false.
2. answer is option (C) for(expression1; expression2; expression3)
this is the format of first line of a for loop. expression1 is initializtion part, expression2 is condition part and expression3 is incrementation part
3. answer is option (c)15
in first for loop it is given that for(i=-1;i<=3;i++), so the loop will repeatedly execute its statements until i value becomes 4. that means for loop will repeatedly execute 5 times when i=-1,0,1,2,3. when i = 4 the condition becomes false and first for loop will exit.
similarly in second for loop it is given that for(j=3;j>=1;j--), initially j=3.for loop will repeat its statements until j=0.that means second for loop also will reatedly execute its statements 3 times when j=3,2,1.when j=0 the condition becomes false and second loop will exit.so the second for loop will execute each time when the first for loop start to execute. therefor count statement will execute 5*3 = 15 times. so count=15
4. sorry....this question is not clear.
******************THANKS*********PLS GIVE ME GOOD RATING************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.