Ask Question
24 June, 20:18

Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value is smaller than m's. Write the code necessary to compute the number of perfect squares between k and m. (A perfect square is an integer like 9, 16, 25, 36 that is equal to the square of another integer (in this case 3*3, 4*4, 5*5, 6*6 respectively).) Associate the number you compute with the variable q. For example, if k and m had the values 10 and 40 respectively, you would assign 3 to q because between 10 and 40 there are these perfect squares: 16, 25, and 36,.

+1
Answers (1)
  1. 24 June, 21:46
    0
    The correct answer of the given question is:

    The following code is written in python.

    i = 1

    q = 0

    while i * i < k:

    i + = 1

    while i * i < = m:

    q + = 1

    i + = 1

    Explanation:

    Firstly we have two variables which is "k" and the second one is "m" and they have a positive integer value

    If we discuss about to our code then, we take a variable "i" and value assign to it is "1" and then we take another variable "q" and value assign to it is "0", as per the question we check the condition of the variable "k" and then "m".
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value is smaller ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers