Question

Can someone please explain this

1. Determine the output

a = 3

b = 4

c = 10

While a < c

a = a + 2

b = b * 2

Endwhile

Output a, b, c

2. Determine the output

k = 4

m = 0

n = 7

While j < k

m = 5

While m < n

Ouput “X”

m = m + 1

Endwhile

j = j + 1

Endwhile

Output j, k, m, n

Answer #1

1) final output values of a, b, c will be:

a=11

b=64

c=10

Here the while loop starts with initial values as a=3, b=4 and c=10

Since (a<c) i.e 3<10 the loop executes as follows

a=a+2 (3+2)

b=b*2 (4*2)

after first iteration, a=5 and b=8

Since (a<c) i.e 5<10, second iteration begins:

a=a+2 (5+2)

b=b*2 (8*2)

after second iteration, a=7, b=16

since (a<c) i.e 7<10, third iteration begins:

a=a+2 (7+2)

b=b*2 (16*2)

after third iteration, a=9,b=32

Since (a<c) i.e 9<10, fourth iteration begins:

a=a+2 (9+2)

b=b*2 (32*2)

after fourth iteration, a=11, b=64

Now, since (a<c) evaluates to false I.e 11 is not less then 10, the loop stops.

Hence giving the final values as:

a=11

b=64

c=10

Can someone please explain this in steps?
2. Determine the output
k = 4
m = 0
n = 7
While j < k
m = 5
While m < n
Ouput “X”
m = m + 1
Endwhile
j = j + 1
Endwhile
Output j, k, m, n

2. Write the output matrix “v”
t = [2:4];
k = [1:3];
v = t.*k – k.^2
4. Given: D = [1 2 3 4 5 6 7 8 9] (3x3) . Which command will
extract the submatrix [1 2 3 4 5 6] (2x3) ?
a. D[1:2,1:3]
b. D(1,2 ;1,3)
c. [D(1:2),D(1:3)]
d. D(1:2,1:3)
14. What will be the dimension of matrix B?
B=[ones(3) zeros(3) rand(3); 2*eye(9)]
18. Find the value of “C”
A=1:2:10;
B=linspace(1,5,5);
C = length(A)*B(2)+A(5)*B(3);
19....

can someone edit my c++ code where it will output to a file. I
am currently using xcode.
#include <iostream>
#include <cctype>
#include <cstring>
#include <fstream>
using namespace std;
bool inputNum(int [],int&,istream&);
void multiply(int[],int,int[],int,int[],int&);
void print(int[],int,int,int);
int main()
{ifstream input;
int num1[35],num2[35],len1,len2,num3[60],len3=10,i;
input.open("multiplyV2.txt"); //open file
if(input.fail()) //is it ok?
{ cout<<"file did not open please check it\n";
system("pause");
return 1;
}
while(inputNum(num1,len1,input))
{inputNum(num2,len2,input);
multiply(num1,len1,num2,len2,num3,len3);
print(num1,len1,len3,1);
print(num2,len2,len3,2);
for(i=0;i<len3;i++)
cout<<"-";
cout<<endl;
print(num3,len3,len3,1);
//cout<<len1<<" "<<len2<<"
"<<len3<<endl;
cout<<endl;
}
system("pause");
}
void...

A (–4, –1, 2), B (3, –2, –1) and C (–1, 3, –4),
AB= 7? − ? − 3?
CB = 4? − 5? + 3?
AC = 3? + 5? - 2?
Question 7: Express the vector AC as the sum of two vectors: AC
= ? + ?, where ? is parallel to the vector CB and ? is
perpendicular to CB. Given that AC ∙ CB = −26 and that CB = √50,
determine the y-component of...

1) SET t = 23
set a = 18
set b = 5
WHILE a>b
INCREMENT t
INCREMENT b
DECREMENT a
ENDWHILE
PRINT a and t
select one: don't need to explain
a) 13 and 26
b) 11 and 30
c) 12 and 31
d) 12 and 28
2) set t = 0
set a = 0
set b = 5
WHILE a <b
INCREMENT t
INCREMENT a
ENDWHILE
PRINT a and t
select one: dont explain
a) 3 and...

For the reaction
A + 2 B + C → 3 D + 2 F
the following experimental data were obtained.
Experiment
[A] (M)
[B] (M)
[C] (M)
Rate (M/min)
1
0.10
0.10
0.10
2.0 x 10-5
2
0.10
0.10
0.30
6.0 x 10-5
3
0.20
0.10
0.10
8.0 x 10-5
4
0.10
0.40
0.10
2.0 x 10-5
Part #1:
Which represents the correct rate law?
A) Rate = k
[A]0[B]2[C]
B) Rate = k
[A]2[B]0[C]
C) Rate = k...

Could someone do parts A) and B) please?
The following information is for a monopoly:
P
Q
TR
TC
MR
MC
6
0
1
5
1
3
4
2
6
3
3
10
2
4
15
1
5
21
0
6
28
a) Fill in the above table. At what quantity does this firm
maximize profits? At what price does this firm sell its output?
Draw a graph to illustrate profit maximization.
b) Explain the two effects on total revenue...

Activities
Predecessors
Duration(weeks)
Labour
A
4
5
B
A
3
5
C
B
2
5
D
C
1
5
E
B
2
5
F
E
8
5
G
D
10
5
H
B
2
5
I
B
3
5
J
F,G,I
3
5
K
H
2
5
L
J,K
3
5
M
L
1
5
i.Construct an activity on the arrow network
ii. Determine the Duration of the Critical Path;
iii. Draw the corresponding Gantt chart
iv. Draw the resource...

1.Planes x = 0 and x = 4 carry current K = -10 ̂az A/m and K =
10 az A/m, respectively. Determine H at (a) (1, 1, 1) (b) (0, - 3,
10)
(c) (-1, -1, -1) (d) (7, 1, 0)
2.. A current distribution gives rise to the vector magnetic
potential A =
Z2Yax+X2Y2Z2ay-8XYZ2az
Wb/m. Calculate (a) B at (1, -2, 5) (b) The flux through the
surface defined by x = 1, 0 <= y<=
5, 0...

1. A plane passes through A(1, 2, 3), B(1, -1, 0) and
C(2, -3, -4). Determine vector and parametric equations of
the plane. You must show and explain all steps for full marks. Use
AB and AC as your direction vectors and point A as your starting
(x,y,z) value.
2. Determine if the point (4,-2,0) lies in the plane with vector
equation (x, y, z) = (2, 0, -1) + s(4, -2, 1) + t(-3, -1,
2).

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 22 minutes ago

asked 23 minutes ago

asked 44 minutes ago

asked 57 minutes ago

asked 57 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago