Answer:
output: 2020
it prints 20 value 2 times.it is not 2020
tracing:
x is an integer and having value 20
x=20
count=0 and it is also a integer
There a do-while loop.
Now loop is initiated.
And loop iterates for two times because while (count<2).
1st iteration
cout<<x
It prints 20.
x=4*(x+5)/5
x=4*(20+5)/5
x=4*25/5
x=100/5=20
So again x=20
In next line count incremented so count =1
count<2 --> 1<2,true
2nd iteration
cout<<x
It prints 20 again.
Again x=4*(x+5)/5
x=20
count incremented so count=2
count<2 ,2<2 false so
The final output is 2020.
trace e following C++ program and provide the correct output: int x = 20, count=0; do...
Thie What is the output of the following program segment? int count 1; do System.out.print(count (count-) + while(count++ <= 5);
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...
Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph
What is the output?
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;
1. What is the output of the following program? include <stdio.h> int wilma (int x) if (x<5) x = 7; return (x) int main (void) int x-1 x=wilma (x) ; printf ("%d", x); return (0) b)3 c) 4 d) 7 a) 1 e) none of these
using C++ 1. Convert the following while loop into a for loop: int count = 0; while (count < 10) x = count + sin(x); y = count + cos(y); count++;
Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int main0 // define two integers int x-3; int y = 4; //print out a message telling which is bigger if (x >y) i cout << "x is bigger than y" << endl: else cout << "x is smaller than y" << endl; return 0; Example (5) Write a C++ program that takes from the user a number in SR (Saudi Riyal) then the program...
C++ What output does the following program produce? int getValue(int a, int b, int n); int main() cout << getValue(1, 7, 7) << endl; return 0; } // end main int getValue(int a, int b, int n) int returnValue = 0; cout << "Enter: a = " < a << " b = " << b << endl; int c = (a + b)/2; if (C* C <= n) return value = c; else returnValue = getValue(a, C-1, n); cout...
11) What is the output of the following Che statements? void Exam(int N) { int list1[3] { 2, 4, 6); if (NX2 - 0) cout << listi[N - 1); else cout << listi[N 5):) void main() { int list[3] - (1, 3, 5); Exam(list[2]);} A) 2 B) 4 C) 6 D) 3 12