COMP115 Lecture Notes - Lecture 5: Ellipse

27 views2 pages

Document Summary

Break; exits the loop that was before it. More complex structures there is absolutely no restriction on how the two control structures can be used (n/2)*n. 1. i=1 -> k loop executed 1 time i=2 -> k loop executed 2 time i=3 -> k loop executed 3 time i=10 -> k loop executed 10 time. State(cid:373)e(cid:374)t executes a total of (cid:1005) + (cid:1006) + (cid:1007) (cid:1005)(cid:1004) = (cid:1005)(cid:1004)*(cid:1005)(cid:1005)/(cid:1006) = (cid:1009)(cid:1009) (cid:1005)+(cid:1006)+(cid:1007) +(cid:374) = (cid:374) *(cid:894)(cid:374)+(cid:1005)(cid:895)/(cid:1006) I = 1 -> k = (cid:1005)(cid:1004), (cid:1013), (cid:1012), (cid:1006) (cid:894)(cid:1013) ti(cid:373)es(cid:895) I = 2 -> k = (cid:1005)(cid:1004), (cid:1013), (cid:1012), (cid:1007) (cid:894)(cid:1012) ti(cid:373)es(cid:895) I = 5 -> k = (cid:1005)(cid:1004), (cid:1013), (cid:1012), (cid:1010) (cid:894)(cid:1009) ti(cid:373)es(cid:895) Statement executed 9 (i=1) +8 (i=2) +7 (i=3) + 6 (i=4) +5 (i=5) Making loop circles size (300, 300); background (255); for(float x= width/8; x < width; x+=width/4) { println ("x = "+x); for(float y = height/8; y < height; y+=height/4) { ellipse (x, y, width/4, height/4);

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions