1. Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and
1. Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and the value of the variable limit is 10.
a. !( ((count < 10) || (x < y)) && (count >= 0) )
b. (limit < 20) || ((limit/count) > 7)
c. ((limit/count) > 7) && (limit < 0)
d. (limit < 0) && ((limit/count) > 7)
3. Write a multiway if-else statement that classifies the value of an int variable n into one of the following categories and writes out an appropriate message:
n < 0 or 0 n 100 or n > 100
8. Write a program to score the paper-rock-scissor game. Each user types in either P, R, or S. The program then announces the winner and the basis for determining the winner: Paper covers rock, Rock breaks scissors, Scissors cut paper, or Nobody wins. Be sure to allow the users to use lowercase and uppercase letters. Your program should include a loop that lets the user play again until they want to stop.
9. Write a program that finds and prints prime numbers between 3 and 100. A prime number is such that 1 and itself are the only numbers evenly dividing it (for example, 3, 5, 7, 11, 13, 17, ).
10. The Fibonacci numbers are a sequence of integers in which the first two elements are 1, and each following element is the sum of the two preceding elements. The mathematical definition of each kth Fibonacci number is the following:
() = { ( 1) + ( 2), > 2 1, 2
The first 12 Fibonacci numbers are 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Write a program that computes and prints the first 12 Fibonacci numbers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started