Log in

View Full Version : Write a function c


Anar22
Dec 13, 2011, 07:03 AM
Part a:
write a function named (rollTheDie)
that does not take any parameter.
The function should roll a die twice(two times)Each roll will generate a random number between 1
and 6 inclusive. The function should return 1 if the sum value of the two rolls is 7
The function should return 0 if the sum value of the two rolls is 11
If the sum is neither 7 nor 11.
the function should return 2.

partb:
write a main function that calls rollTheDie function and print if the result is 7 or 11 or not 7 or 11

Anar22
Dec 13, 2011, 07:05 AM
Can any one help me