retagged by
472 views
0 votes
0 votes
Consider the following program:
function mu(a,b:integer) returns integer;
var i,y: integer;
begin
---------P----------
i = 0; y = 0;
while (i < a) do
begin --------Q------------
y := y + b ;
i = i + 1
end
return y
end
Write a condition P such that the program terminates, and a condition Q which is
true whenever program execution reaches the place marked Q above.
retagged by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
1 answer
2
sripo asked Feb 15, 2019
533 views
Let a and b be positive integers such that a b and a^ 2 − b^ 2 is a prime number.Then a^2 − b^ 2 is equal to(A) a − b(B) a + b(C) a × b(D) none of the above
3 votes
3 votes
1 answer
3
sripo asked Feb 15, 2019
817 views
When is the following statement true? (A ∪ B) ∩ C = A ∩ C(A) If Ā ∩ B ∩ C = φ(B) If A ∩ B ∩ C = φ(C) always(D) never
2 votes
2 votes
2 answers
4
sripo asked Feb 15, 2019
515 views
T (n) = T (n/2) + 2; T (1) = 1When n is a power of 2, the correct expression for T (n) is:(A) 2(log n + 1)(B) 2 log n(C) log n + 1(D)2 log n + 1