CSci 1101 Lab 5. Due Thursday, Feb. 25 at 11:59pm

Work in groups of two.

Loops exercise (10 points)

Write a program that uses php function rand() to simulate a roll of a six-sided die. Write a loop to find 5 random rolls, print them out, add them all together by keeping a running total, and display the sum.
Some hints: start by writing a loop to repeat the roll of a die 5 times. In the loop store the die value in a variable and print out the variable. Once you get this to work, think of how you would find the sum. You need an extra variable to accumulate the sum. Think of what that variable should be before the loop and how it changes in the loop. Print the variable after the loop.

To submit

Save the files on csci1101sp10 or, if using remote access, upload them to csci1101sp10. Send me an e-mail with the URLs of your work when done. Both group partners must be on CC list for this.

CSci 1101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.