OUTPUT:
Explanation:
1. When i=4, b=10.0 and c=19.0, clearly b<c then "10.0 < 19.0" will be printed
2. Now, i=5 , b=11.0 and c = 17.0 clearly b<c then "11.0 < 17.0" will be printed
3. Now, i=6 , b=12.0 and c = 15.0 clearly b<c then "12.0 < 15.0" will be printed
4. Now, i=7 , b=13.0 and c = 13.0 b<c is False, and i>8 is also False
else condition will run, "7' will be printed. and c = 14.0
5. Now, i=8 , b=14.0 and c = 14.0 - 2=12.0 b<c is False, and i>8 is also False
else condition will run, "8' will be printed. c = 13.0
6. Now, i=9, b=15.0, c = 13.0 - 2 = 11.0 b<c is False, but i>8 is True So, print(b+c) will execute
"26.0" will be printed.
7. Now i=10 while loop will be terminated.
What is the output of the following code fragment? int i = 1; while( i <= 5 ) if(i == 2 || i == 4) System.out.println(i + ":" + " is an even index) System.out.println("i: " + i); i++;
How many 'X's will be output? while (i <=3){ k=1: while (k <- i) { cout << "x"; cout << endl; ++i;)
Predict the outcome of each line: F1 F0 while i<10: i+=1 j+=2*2 print(i) #Line 1 print() # Line 2
What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...
Consider the following C++ code segment: if (i j) cout << "1"; else if ((i &j) < 3) cout << "2"; else if (i < (j-1)) cout << "3"; else cout << "4"; cout << "5"; If the value of iis 5and the value of jis 6, which of the options below gives the correct output? 1. 25 2. 35 3. 15 4. 45
pic 4: Loops What is the output of the following code? int main0 ( int x = 1; while (x < 7) t İf ( (x % 2)-= 1)(1/ if x is odd x=x+1; else t x = x + 2; return 0; Select óne O a. 124 6 8 O b. 1 234 5 6 7 O c. 246 O d. 24 6 8 PREVIOUS PAGE NE
List all the left cosets of H in G. a. and b. and H =< (123) > G= 44 H =< (1234) > G= 54
What will the output be in the following? int a, b, c; a-b-0; c 5; ific< 1011 (a = = 0 &&b != 0)) 3. cout<<True"; else cout<<"False", What will the output be in the following? a. int icount; 4. do count = 0; cout<<"The count is "<cicount<<endl; while(icount<10); int count = 0; do b. cout<<"The count is “<<count<<endl; while++icount<10); c. for(int n 5; n>0; n-) cout<<n;
a) in cylinder A B b) in cylinder B C Aluminum 16 in. 1.7 in. T- 13.6 kip in. Brass 24 in. <-2.5 in.
ed What is the output after execution of the code block {for (int i=1;i<=4; i++) {if (i==3) continue; cout<<"-"<<i; i++}} 1.00 on Select one: a.-1-3 b.-1-2 C.-1-4 O d.-2-3