AP Computer Science - More Nested Loop Practice and Solutions

in #tutorials7 years ago

APCSLogo.png

I used this as a bell work yesterday, maybe similar concepts on a quiz soon! Haha.
Analyze, by hand, what each loop below does:

Ex 1

Solution

Ex 2

Capture.PNG

Solution

This results in an infinite loop unfortunately! Haha. You have to run few it a few times to figure it out!

Ex 3

Solution

One More Thing...

Write a void method that takes two parameters (integers), a number of rows and columns, and prints a block of numbers with that size.

Solution

Capture.PNG

Output Example for 4 rows and 3 columns


BAR.png

All SteemitEducation Posts

Physics

Kinematics Video, Circular Motion Video, Forces in 1 & 2 Dimensions Videos, Kinematics Full Lesson, Circular Motion and Gravitation Full Lesson, Kinematics and Forces Quiz, Forces in 1-Dimension, Forces in 2-Dimensions, Basic Physics, Kinematics, and Forces Review, AP Physics Midterm Exam, AP Physics Midterm Exam Solutions

Computer Science

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16

SAT

Asymptotes, Composite Functions, Contest 1 - Area, Contest 1 – Winners and Solution, PEMDAS, Systems of Equations, Functions, Exponents, Contest 2 - More Functions, Contest 2 – Winners and Solution, Percents, The Interest Equation, All About Division, Contest 3 - Factoring, Contest 3 – Winners and Solution, Fractional and Negative Exponents, Basic Trig, Contest 4 - Math Vocab, Contest - 5, Contest 5 – Winners and Solution, Contest 6, Contest 6 – Winners and Solution

General Math

Basics of Algebra, Trigonometry Video, Proof of Quadratic Formula, Factoring Video, Unions and Intersections, Surface Area of a Cylinder, Substitution Video, Combinatorics Basics

Graphing from Algebra to Calculus

Algebra 1, Algebra 2, Pre-Calculus, Calculus

Piloting Airplanes

Introduction, Preflight, Requirements, Instruments, Take-Offs and Landings, Why a Plane Can Fly, Reading the Runway, Maneuvers

Other

Engineering (Isometric) Drawing, Pressure & SCUBA Diving

BAR.png

Thank you for your viewing my friends! The support is much appreciated! Learn much and best wishes!

STMEdu.gif

SteemWave.gif

Sort:  

very healful post dear friend @hansenator

You'll have to wait your turn, sir.

Thank you khurshid. Hope to keep helping everyone!

This post has received 50% upvote from @minnowspower thanks to: @theguruasia

MinnowsPower is not a bot, I am a Crowdfunding Hybrid

thanks for sharing important mathematics @hansenator

Thank you reyajahmedrazu! Any time I can I will!

Hello there, SexyWhaleBot is a soon-to-be-powered-up bot designed to help minnows grow.

Effective immediately, SexyWhaleBot will provide a free upvote to 5 randomly selected followers and 5 randomly selected recent post upvoters each day.

In order to live up to his name, SexyWhaleBot will once per day randomly select and post a compilation of sexy girls from its well-sorted libraries.

Take your chance and be among the first supporters of SexyWhaleBot – until the word is spread, it will be very easy to get the free upvotes.

Have a sexy and profitable day! : ]