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]
3 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]3 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
43 ones x 3 ten equals
Svet_ta [14]
The answer is 1230!!!!!!!
4 0
3 years ago
Read 2 more answers
Claires mother is 4 years more than twice claires age
Zina [86]

m= 4+ 2c is true if m is claires mom and c is claire

5 0
3 years ago
Read 2 more answers
Solve <br> (2x^3 + x^2+ x) ÷X
lina2011 [118]

Answer:

the answer is 2x^{2} +x+1

hope this helps!!

7 0
3 years ago
Read 2 more answers
What would be the volume of the cone that has the same measurement as the cylinder above in the pic
fomenos

▪▪▪▪▪▪▪▪▪▪▪▪▪  {\huge\mathfrak{Answer}}▪▪▪▪▪▪▪▪▪▪▪▪▪▪

Volume of cone will be ~

\fbox \colorbox{black}{ \colorbox{white}{volume} \:  \:  \:   \:   \: \colorbox{white}{=}  \:  \:   \:   + \colorbox{white}{462 \: cm³ }}

\large \boxed{ \mathfrak{Step\:\: By\:\:Step\:\:Explanation}}

Let's find the volume of cone with ~

  • radius (r) = 7 cm

  • height (h) = 9 cm

And as we know, volume of cone is equal to ~

  • \dfrac{1}{3}\pi  {r}^{2} h

now, let's plug in the values and find the volume ~

  • \dfrac{1}{ \cancel{3}  }\times  \dfrac{22}{\cancel{7}}  \times \cancel{7 }\times 7 \times \cancel{9}

  • 1 \times 22 \times 7 \times 3

  • 462 \:  \:  {cm}^{3}

Volume of cone is 462 cm³ = 462 ml

7 0
3 years ago
Official unemployment rates for the U.S. population are reported on a monthly basis by the Bureau of Labor Statistics. For the p
Kitty [74]

Step-by-step explanation:

Clearly, there is a common difference between the monthly employment rates:

8.7% - 8.9% = -0.2%

8.5% - 8.7% = -0.2%

8.3% - 8.5% = -0.2%

a) So, for every month x, the percentage will go down 0.2%, starting at 8.9%. So, we can make this equation:

y = -0.2x + 9.1, where x = 1 would be October 2011.

January 2013 is 16 months after October 2011, so:

y = -0.2(16) + 9.1

y = 5.9%

b) To find when the unemployment rate will be zero, we set the equation equal to zero:

0 = -0.2x + 9.1

-0.2x = -9.1

x = 45.5 months

So, rounding up, the U.S. would reach a zero unemployment rate in 46 months or around September 2014? Not completely sure.

5 0
3 years ago
Other questions:
  • Determine the equation of the line that is perpendicular to the lines r(t)=(-2+3t,2t,3t)
    12·1 answer
  • When solving 5 (<br>25) - 7. What is the correct sequence of operations? (5 points)​
    15·1 answer
  • Sixty photos taken at a photo shoot are in black and white. If this represents 15 percent of the total number of photos taken, w
    11·1 answer
  • The temperature of an enclosure for a pet snake should be about 80°F, give or take 5°F. What are the maximum and minimum tempera
    15·2 answers
  • What is the product of 3 2/3 and 14 2/5
    13·1 answer
  • 7-41=<br><br> (-15)+33=<br><br> 62-84=<br><br> (-26)-14=
    15·1 answer
  • Translate the phrase into an algebraic expression. The product of 4 and y​
    11·1 answer
  • The length of the base of an isosceles triangle is x. The length of a leg is 4x - 7. The perimeter of the triangle is 31. Find x
    8·1 answer
  • Can someone please give me the (Answers) to this? ... please ...<br><br> I need help….
    13·1 answer
  • Calories Used While Swimming for 30 Minutes
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!