Coding an App: Perfect Squares and Square Roots

0
Coding an App: Perfect Squares and Square Roots
Tweet about this on TwitterShare on FacebookPin on PinterestShare on LinkedInShare on Google+Share on TumblrEmail this to someoneShare on StumbleUponShare on RedditDigg this

In this activity we will build an app that 1) generates the first 10 perfect squares and 2) prompts the user to determine the square root of one of them, chosen at random.




screen-shot-2016-10-18-at-7-27-23-am

To begin, create a variable. I have named mine counter. Set counter to 1 to begin and setup the loop structure as seen above. Your loop will loop 10 times, multiply counter by itself each time, and then increment counter by 1.

Essentially it looks like this when it runs:

1 * 1

2 * 2

3 * 3

etc.

Next, chose a random number between 1 and 10. This will refer to the row number of our list.

 

screen-shot-2016-10-18-at-7-27-36-am

Prompt the user to input the square root of the randomly chosen perfect square, set up the math structure and give it a try!

 

 

To see it in action check out the video below:




Try it for yourself:

Project page: https://scratch.mit.edu/projects/126194628/

Tweet about this on TwitterShare on FacebookPin on PinterestShare on LinkedInShare on Google+Share on TumblrEmail this to someoneShare on StumbleUponShare on RedditDigg this
(Visited 158 times, 1 visits today)

Leave a Reply

Name
Name*
Email
Email *
Website
Website