(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. Breaking the Codeby CodeChum Admin ATTENTION SOLDIER! This will be the hardest mission of your life. Our intelligence department has caught the enemy sending codes from one base to another. These enemy codes can either be a simple communication message or a mastermind plan. Our intelligence department has determined that a mastermind plan is a code that has at least 1 consonant character. Since you know programming, your task is to check a code if it is a mastermind plan or not. Instructions: In the code editor, you are provided with a main() function that asks the user for a code. Furthermore, there is a call to the function, hasConsonant().Your task is to declare and define this hasConsonant() function which has the following details:Return type - intName - hasConsonantParameter:char* - to hold the character arrayReturn value - 1 if there is at least 1 consonant and 0 if there is none. Be sure to consider both the capital and small letter consonants…arrow_forward(C PROGRAMMING ONLY!) Your task is to fill in the blank with the correct condition. 5. Finding the Impostorby CodeChum Admin There's this Dog game I played where a group of Dogs gather together and complete missions. One of them though is an impostor because it is not a real dog; its breed is not a dog breed. Your task is to find that impostor. To do this, you need to check Instructions: In the code editor, you are provided with the enum, DogBreed. Furthermore, an initial main() code is provided for you where the user is asked for what the breed of the Dog.Then, in lines 18 - 22, a partial code to check if the breed is valid or not is given.Your task is to fill in the blank with the correct condition. Make sure to use the values of the enum, DogBreed in checking. Input 1. Dog Breed Output Input the breed of the dog: 2Yup, the breed is validarrow_forward(Product of a series) Write a program to calculate the product of the following series: 1 ... 13 21 25 93 97arrow_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(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) 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_forward
- Identify 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'''The expected input and output are given (see right side) but my output and my code (on the left) did not match, what seems to be the problem? Thank you!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
- (discrete structure) the answer either True or false.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++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr