1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Trava [24]
4 years ago
11

Write a for loop that assigns summedvalue with the sum of all odd values from 1 to usernum. assume usernum is always greater tha

n or equal to 1.
Mathematics
1 answer:
Lapatulllka [165]4 years ago
5 0
// Input value is usernum.
// This code snippet sums 1 + 3 + 5 + ... + usernum
//  The answer is stored in the variable summedvalue.

N = (int) (usernum+1)/2;    // maximum number of integers to be summed
int *v = malloc(N*sizeof(int));     //  allocate storage for array v

// Calculate the number of loop counts and assign array v..
count = 0;
k = 1;
while (1) {
       if (k>usernum) {   //  do not extend v beyond usernum
          break;
          }
       v(count) = k;        //  assign an odd integer to v, including usenum
       count++;
       k += 2;                //  k is an odd number
       if k>usernum {          // handle usernum as odd or even
          k = usernum;
          } 
 }
n = count;          // the size of array v.

// Calculate the sum in a for loop
summedvalue  = 0;               // initialize summedvalue
for (i=0; i<=n; i++) {
     summedvalue += v(i);
    }


You might be interested in
Solve for x.<br><br> 4(-2x + 9) = -2(3x - 7)
Gekata [30.6K]

Answer:

x = 11

Step-by-step explanation:

uwu

3 0
3 years ago
Read 2 more answers
A cube with a side length of 1008 units is dropped and completely submerged in a cube-shaped container. If the water level in th
Anni [7]

Answer:

The length of a side of the cube-shaped container is 2,016 units

Step-by-step explanation:

step 1

Find the volume of a cube with a side length of 1008 units

The volume of a cube is equal to

V=b^3

where

b is the length side of the cube

we have

b=1,008\ units

substitute

V=(1,008)^3\ units^3

step 2

Find the length side of the cube-shaped container  

Let    

x-----> the length side of the cube-shaped container in units

we know that

The area of the base of the cube-shaped container multiplied by 252 units must be equal to the volume of the cube with a side length of 1008 units

so

x^{2} (252)=(1,008)^3

solve for x

x^{2} =\frac{(1,008)^3}{252}

x^2=4,064,256

x=\sqrt{4,064,256}

x=2,016\ units

therefore

The length of a side of the cube-shaped container is 2,016 units

5 0
3 years ago
Which fraction has a repeating decimal as its decimal expansion?
Free_Kalibri [48]

Answer:

3/11

Explanation:

Out of all the options, 3/11 is the only one that has repeating decimal.

3/11 = 0.27272.....

7 0
3 years ago
Which function has zeros of -8,1, and 3
grin007 [14]

Answer:

A

Step-by-step explanation:

The zeros of a polynomial function are found by factoring in the form

a(x - r1)(x - r2)(x - r3) ... = 0, where each 'r-something' is a root (or solution) and 'a' is the leading coefficient.

Like if we have 3x² - 3x - 6 = 0

Factoring it as 3(x-2)(x + 1) = 0 shows the roots are 2 and -1.

And sine the right side is zero, we can even drop the factor of 3 on the left, and still have an equivalent equation (has same answers).

(x-2)(x + 1) = 0

The reason this works is because each factor in parentheses adds up to zero, creating a factor of zero in what is being multiplied on the left. And we know that if you have a series of factors in a product, and any one of those factors is zero, the whole product must be zero. So what is on the left equals the zero on the right, making the equation true.

4 0
3 years ago
An investment of $108,000 was made by a business club. The investment was split into three parts and lasted one year. The first
xeze [42]
So the 3 investments were 72,000, 16,000, and 20,000
8 0
3 years ago
Other questions:
  • Monica deposited $26000 in an account that pays 4% interest compounded annually. How much money does she earn after 10 years?
    15·1 answer
  • What is the equation of the function that is graphed as line a?
    8·2 answers
  • Describe , Ella has 50 stacks of ten pennies in each stack.describe how to find how many pennies Ella has in all. For a 7 year o
    9·2 answers
  • (20 points) Need help ASAP!!
    13·1 answer
  • Which statement is true about the expression 4 (9 + 6)?
    10·1 answer
  • Maria is using the digits 2, 4, 5 and 8 to make as many four-digit numbers as she can. What are all the numbers Maria can make?
    11·1 answer
  • Which two steps could be taken to simplify the expression y/3 + 2 = 11?<br>​
    10·2 answers
  • Express the following in the form a + bi, where a and b are real numbers:
    14·1 answer
  • Graph the function. f(x)=|x+2|-1
    15·2 answers
  • Solve for x !<br><img src="https://tex.z-dn.net/?f=x%20%7B%7D%5E%7B2%7D%20%20-%205x%20%2B%206%20%3D%200" id="TexFormula1" title=
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!