(Practice) Write a for statement for each of the following cases:
a. Use a counter named i that has an initial value of 1, a final value of 20, and an increment of 1.
b. Use a counter named icount that has an initial value of 1, a final value of 20, and an increment of 2.
c. Use a counter named j that has an initial value of 1, a final value of 100, and an increment of 5.
d. Use a counter named icount that has an initial value of 20, a final value of 1, and an increment of -1.
e. Use a counter named icount that has an initial value of 20, a final value of 1, and an increment of -2.
f. Use a counter named count that has an initial value of 1.0, a final value of 16.2, and an increment of 0.2.
g. Use a counter named xcnt that has an initial value of 20.0, a final value of 10.0, and an increment of -0.5.
Trending nowThis is a popular solution!
Chapter 5 Solutions
C++ for Engineers and Scientists
- (C PROGRAMMING ONLY) 4. Swapping Placesby CodeChum Admin Phew! Thanks to your help, I was able to entertain the two bored guys. But I would like to ask for your help one last time. I see that there are is this older guy who's bullying a kid. I can reprimand the older guy but I want to handle this situation peacefully. I'm planning to swap the kid's place to another older guy's place so the bully won't be close to the kid. Please help me swap them both. Instructions: You are given a main() function that asks the user for two integer inputs and passes these two values to a function call of the swap() function.The swap function doesn't exist yet so your task is to make its function declaration and implement its function definition.Its details are the following:It accepts two integer addresses as its parametersIt will swap the values found in the two integer addresses. For example, if we have two integer values, a = 5 and b = 10, and we pass their addresses to the function call, by…arrow_forward(python) 25. For the following code, how many loops does it complete? _sum = 0 while _sum > 100: if _sum == 25: break if _sum % 2 == 0: _sum += 15 continue _sum += 10 a. 0 b. 1 c. 2 d. 3 e. 4arrow_forward[A] Instruction: Kindly provide what is asked in the photo below.arrow_forward
- (Python) Is this statement true or false? An else at the end of a while loop is used when the loop condition is no longer true.arrow_forwardIdentify the correct statement, from the given 4 statements. a. A product term is a min term. In this A ->1 and A'->0. O b. A sum term is a min term. In this A ->0 and A'->1. O c. A product term is a Max term. In this A ->0 and A'->1. O d. A sum term is a Max term. In this A ->1 and A'->0.arrow_forward(use Python)Write a script/program that uses a while loop to print the integers from 16 to 1 (including both 16 and 1) each on their own line in descending order.arrow_forward
- (Just need answer)arrow_forward(use Python)Assume a variable num has already been assigned to a positive integer. Use a while loop to compute the sum of the squares of the integers from 1 to num inclusive. Store the result in the variable total.arrow_forward(python) Which command is used to exit out of a loop at any point? a. continue b. break c. exit d. endarrow_forward
- (C PROGRAMMING ONLY) 2. Create a program that will display the pattern. (Use NESTED FOR LOOP only) Sample output:arrow_forward(c program only) 2. Jack `N Poyby CodeChum Admin Jack `N Poy is a very common game since our childhood days. Just thinking about it makes me reminisce how I crushed my cousin in this game until he cried ? I want to feel the glory again of being very good at something. Could you help me recreate the game? It's really simple. In Jack `N Poy, there are two players who both select either one of the following options: RockPaperScissors The winner is selected depending on the following rules: Rock beats ScissorsScissors beats PaperPaper beats RockIf both players chose the same option, then it's a tie Instructions: In the code editor, you are provided with an enum called option which contains three possible named values:ROCK - 'r'PAPER - 'p'SCISSORS - 's'Your task is to ask two users for there chosen options. And then based on their options, determine the winner.Input 1. Option selected by Player 1 2. Option selected by Player 2 Output If Player 1 wins, print the message "Player 1…arrow_forward(python) Write a loop that runs 10 times and inputs data from the user. That data is added to a running total. After the loop is finished, output the total.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr