Assume there is a variable, h that has already been assigned a positive integer value. Write the code necessary to count the number of perfect squares whose value is less than h, starting with 1. (A per fect 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). Assign the sum you compute to a variable q For example, if h is 19, you would assign 4 to q because there are perfect squares (starting with 1) that are less than h are: 1, 4, 9, 16.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question
100%

Code in Python

Assume there is a variable, h that has already been assigned a positive integer value. Write the code
necessary to count the number of perfect squares whose value is less than h, starting with 1. (A per
fect 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). Assign the sum you compute to a variable q For example, if h is 19,
you would assign 4 to q because there are perfect squares (starting with 1) that are less than h are:
1, 4, 9, 16.
Submit
History:
x - (6 of 6) - 02/26/21 9:42am
Transcribed Image Text:Assume there is a variable, h that has already been assigned a positive integer value. Write the code necessary to count the number of perfect squares whose value is less than h, starting with 1. (A per fect 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). Assign the sum you compute to a variable q For example, if h is 19, you would assign 4 to q because there are perfect squares (starting with 1) that are less than h are: 1, 4, 9, 16. Submit History: x - (6 of 6) - 02/26/21 9:42am
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Troubleshooting
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning