14.3 How many times is the statement cout<<]<<","<</<<","; executed in the following program? int I, );...
In the code given below, how many times the cout statement is executed? for (int x = 0; x< 10; x++) for (int y=0; y < 10; y++) for (int z = 0; z <=10; z++) cout << X+y+z;
5.2 How many times this for loop will execute? for (i = 0; i <= 100; i++) ANN cout<<i+8<<endl; WA Am } Answer:
How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...
C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What is the output of the following code snippet? int time 1; int year2 int rate = 1; int principal = 5; int interest-0 cout <<i < endl while (year< 5) interest (principal * time rate) /1 ; cout << interest << endl; year++
Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;
3. How many times "hello" is get printed? for(int x=-1; x<=10; x++) { if(x < 5) continue; cout<<"hello"<<endl; }* (3 Points) 5 times 11 times Infinite times 6 times
1. What is wrong with the following C++ program? #include <iostream> int main() { a = 4; b = 6; cout << a << "+" << b << "=" << a+b; return 0; 2. What is wrong with the following C++ program? What was its intended output? #include <iostream> using namespace std; int main() { cout << "What is larger? e pi or pi e?" << endl; double ans1 = exp(pi); double ans2 = pi exp(1.); cout << "epi is...
How many 'X's will be output? while (i <=3){ k=1: while (k <- i) { cout << "x"; cout << endl; ++i;)
When the Java source code below is executed, how many times is the boolean expression (j > 0) evaluated? int i 1; do { int j 35; while (j > 0) { j = j / 2; = } i += 1; } while (i <= 3); 18 none of the other answers are correct 0 6 36
or (int i - 3; i<ll; i-i+2) Solution: cout< iend; i-i2 B) What will the following program fragment output? (2 points) int mainc int j 7, d 2; double sum 0; 5 Solution: sumd; --ji 9 10 cout<esum; 12 13