Monday, February 3, 2014
Section 3.1: Numbers - Precedence
40036: Write an expression that computes the average of the values 12 and 40.
(12 + 40) / 2
40037: Write an expression that computes the average of the variables exam1 and exam2 (both declared and assigned values).
(exam1 + exam2) / 2
40333: Write an expression that cmputes the average of the values 12 and 40.
(12 + 40) / 2
40334: Write an expression that computes the average of the varialbes exam1 and exam2 (both declared and assigned values).
(exam1 + exam2) / 2
41015: Each of the walls of a room with square dimensions has been built with two pieces of sheetrock, a smaller one and a larger one. The length of all the smaller ones is the same and is stored in the variable small. Similarly, the length of all the larger ones is the same and is stored in the variables large. Write a single expression whose value is the total area of this room. DO NOT use the pow function.
(large + small)^2
41013: The dimensions (width and length) of room1 have been read into two variables: width1 and length1. The dimensions of room2 have been read into two other variables: width2 and length2. Write a single expression whose value is the total of the two rooms.
(width1 * length1) + (width2 * length2)
41020: Assume that children is an integer variable containing the number of children in a community and that families is an integer variable containing the number of families in the same community. Write an expression whose value is the average number of children per family.
children / families
41017: In mathematics, the Nth harmonic number is defined to be 1 + 1/2 + 1/3 _ 1/4 + ... + 1/n. So, the first harmonic number is 1, the second is 1.5, the third is 1.833... and so on. Write an expression whose value is the 8th harmonic number.
1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8
41016: Three classes of school children are selling tickets to the school play. The number of tickets sold by these classes, and the number of children in each of the classes have been read into these variables: tickets1, tickets2, tickets3 and class1, class2, class3. Write an expression for the average number of tickets sold per school child.
(tickets1 + tickets2 + tickets3) / (class1 + class2 + class3)
41019: In mathematics, the Nth harmonic number is defined to be 1 + 1/2 + 1/3 _ 1/4 + ... + 1/n. So, the first harmonic number is 1, the second is 1.5, the third is 1.833... and so on. Assume that n is an integer variable whose value is some integer N greater than 1. Assume also that hn is a double variable whose value is the Nth harmonic number. Write an expression whose value is the (n-1)th harmonic number.
hn - (1.0/n)
41018: In mathematics, the Nth harmonic number is defined to be 1 + 1/2 + 1/3 _ 1/4 + ... + 1/n. So, the first harmonic number is 1, the second is 1.5, the third is 1.833... and so on. Assume that n is an integer variable whose value is some integer N greater than 1. Assume also that hn is a double variable whose value is the Nth harmonic number. Write an expression whose value is the (N+1)th harmonic number.
hn + 1.0 / (n + 1)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment