Question

For each case, write a for statement that prints the sequences of its values: a) 36,...

For each case, write a for statement that prints the sequences of its values:

a) 36, 18, 9, 4,

b) 1.0, 5.0, 9.0, 13.0, 17.0, 21.0,

c) 20* 15* 10* 5* 0* -5*

0 0
Add a comment Improve this question Transcribed image text
Answer #1
a)
for(int i=36; i>=4; i = i / 2) {
        cout << i << endl;
}

b)
for(float i=1; i<=21; i = i + 4) {
        cout << i << endl;
}

c)
for(int i=20; i>=-5; i = i - 5) {
        cout << i << endl;
}

if any issues, ask in comments. Thanks!

Add a comment
Know the answer?
Add Answer to:
For each case, write a for statement that prints the sequences of its values: a) 36,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Java programming Using IF statement, write a program that prints multiplication table for 1-10. Sample...

    in Java programming Using IF statement, write a program that prints multiplication table for 1-10. Sample Program Output. 1     2     3     4     5     6     7     8     9     10       1     1     2     3     4     5     6     7     8     9     10       2     2     4     6     8     10    12    14    16    18    20       3     3     6     9     12    15    18    21    24    27    30       4     4     8     12    16    20    24    28    32    36    40       5     5     10   ...

  • Question (1) Write for statements that print the following sequences of values a) 30, 20, 10,...

    Question (1) Write for statements that print the following sequences of values a) 30, 20, 10, 0, –10, –20, –30 b) 15, 23, 31, 39, 47, 55 Question (2) Write a function call it cube to find the cube of each number. Please write this in programming C language and please explain what we are doing in each step.

  • C programming! Write a program that reads integers until 0 and prints the sum of values...

    C programming! Write a program that reads integers until 0 and prints the sum of values on odd positions minus the sum of values on even positions. Let ?1, ?2, … , ??, 0 be the input sequence. Then the program prints the value of ?1 − ?2 + ?3 − ?4 + ⋯ ??. The input is a sequence of integers that always contains at least 0 and the output will be a single number. For example, for input...

  • Statement Write a program that takes two upper case letters as input and prints its position...

    Statement Write a program that takes two upper case letters as input and prints its position number in alphabet sequence, [A, B, C, .... X, Y, Z, AA, AB, AC, AD .... AX, AY, AZ, ... ZX, ZY, ZZ] Sample input 1 AA Sample output 1 (26 * 1) + 1 = 127 Sample input 2 AB Sample output 2 (26 * 2) + 2 = 28 Sample input 3 KE Sample output 3 (26 * 11) + 5 =...

  • Below are four bivariate data sets and the scatter plot for each. (Note that each scatter...

    Below are four bivariate data sets and the scatter plot for each. (Note that each scatter plot is displayed on the same scale.) Each data set is made up of sample values drawn from a population. x y 1.0 7.9 2.0 5.1 3.0 10.1 4.0 6.4 х 11 10+ 9+ 8+ 7+ 6+ 5- X X 1.0 7.3 117 10+ 2.0 9.0 9+ 3.0 7.3 8+ 7 4.0 5.6 6+ 5.0 7.9 5 4 6.0 5.3 2 7.0 4.8 5.0...

  • Below are four bivariate data sets and the scatter plot for each. (Note that each scatter...

    Below are four bivariate data sets and the scatter plot for each. (Note that each scatter plot is displayed on the same scale.) Each data set is made up of sample values drawn from a population. y 1.0 7.4 2.0 9.0 3.0 7.0 11 10- 11 102 9 8+ 7+ 8+ 71 61 5 5 41 4.0 5.4 5.0 7.5 6.05.2 7.0 4.5 8.0 7.1 9.0 5.5 10.0 3.9 V 1.0 8.0 2.0 6.9 3.07.3 4.0 6.1 5.0 7.4 6.0...

  • Write a method printCostTable() that prints out a table like the following: price carpet fitting 5.0...

    Write a method printCostTable() that prints out a table like the following: price carpet fitting 5.0 150.0 120.0 9.0 270.0 120.0 13.0 390.0 120.0 The method should take four int arguments representing the width and length of the carpet, a start price and an end price. The method should first print the headings price carpet fitting It should then print the price, carpet cost and fitting cost for each price starting from startPrice and increasing in increments of £4, up...

  • Using java E6.17 Write a program that prints a multiplication table, like this: 1 2 3...

    Using java E6.17 Write a program that prints a multiplication table, like this: 1 2 3 4 56 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 10 20 30 40 50 60 70 80 90 100

  • IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the...

    IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the following sequences. The sequences are printed by the for loops found in the function. The information below shows how you would call the function printSeqs() and what it would display: Write a for loop that iterates through a list of names and print a greeting for each name in the list. Request from the user a positive integer n and prints all the positive...

  • CHALLENGE ACTIVITY 3.4.2: Detect number range. Write an expression that prints "Eligible" if userAge is between...

    CHALLENGE ACTIVITY 3.4.2: Detect number range. Write an expression that prints "Eligible" if userAge is between 18 and 25 inclusive. Ex: 17 prints "Ineligible", 18 prints "Eligible". 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class AgeChecker { public static void main (String [] args) { int userAge = 0; userAge = 17; if( /* Your solution goes here */ ){ System.out.println("Eligible"); } else{ System.out.println("Ineligible"); } return; }...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT