Exam 1- 2012

The area of a square the square of s s2 the perimeter

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: sume: o A variable A already exists and contains a value for you to use. Do not try to redefine A or overwrite its value. o Assume that the math library has been imported. Your task: If A is the area of a square, print the perimeter of that square. Helpful facts: A square has 4 sides that are all the same length (call it s). The area of a square = the square of s (s2) The perimeter of a square = the sum of the 4 sides (4s) CS 115 Exam 1, Fall 2012 Page 5 of 8 (c) Repeat the following actions 500 times (your user is very patient): • Ask the user for the name of a band they like. • If the user types Rebecca Black, print Really?! • If the user types anything else, print nothing and go on to the next band. (d) Prompt your user to enter 1000 numbers (you should prompt them 1000 times). You can assume that the user enters 1000 valid numbers. After the user has entered all of the numbers, print the number of times...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online