Below is the Program for Collatz Sequence. I have included program and output in the same screen shot.
You are to take the conditional from the previous section and build a loop around it...
11) 16 pts. Convert the following for loop to a while loop. (You may want to do the following question first.) int mine [5] = {10, 11, 12); for (int j=1; j < 5; j++) cout <<j<< "" << mine[jl <<" " << end1; 12) 6 pts. What is the output of the previous question? 13) 4 pts. Circle the variables that would NOT cause syntax errors 2-smaTT , entry# break -my-int
2. Rewrite the following loop into a while loop statement: (4 Marks) (CLO2:PLO5:C2) int i, b; cout<<"Please enter the lower bound of the loop:\n"; cin>>b; for (i = 70; b = i; i--) cout << i << endl; CSCS1511/March2019 Page 4 of 6
II. SHORT ANSWER QUESTIONS. (10, 2 POINTS FOR EACH QUESTION) 1. What will the following loop display? int x = 0; while (x <5) cout<<x << endl;
Problem 30.46 < 13 of 13 > A 4.0-cm-diameter loop with resistance 0.10 S2 around a 2.0-cm-diameter solenoid. The solenoid is 15 cm long, Io hoooooooooodbo 4.0 cm 2.0 cm has 100 turns, and carries the current shown in the graph Isol (A) 20 - Tito It() Problem 30.46 ③ 13 of 13 - Part A Find the current in the loop at t = 0.5 s. Express your answer as an integer and include the appropriate units. I(0.5) =...
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...
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...
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;
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++
A sequence has the discrete-time Fourier transform 1 - a2 X(e) ae-jw)2(1- aejw) la| < 1 (a) Find the sequence r[n] (b) Calculate X(eju)cos(w)dw/27
1. The surface encircled by a rectangular loop of N turns on y=2 plane is defined by -1< x<3 and 0 <z<3. Magnetic field is given by B = (a, 2xt + â,4yt?) cos wt. Find the emf induced in the loop as a function of time (x,y, z are in meters; Ę is in mT; t is in seconds)