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
Anybody know how I can get better at algebra 1, because I'm struggling​
IrinaK [193]

Answer:

Step-by-step explanation:

Know Your Arithmetic

Remember PEMDAS

Get Positively Comfortable with Negative Numbers

Show Your Work

Don't Let the Letters Scare You

Be Sure to Answer the Right Question

Work Practice Problems

Calculator

Join a study group

3 0
2 years ago
What is the measure compliment for 57 degrees
puteri [66]
To find this, simply subtract 57 from 90. 90 is the measurement for a completed compliment equation, and 57 is the part of the compliment we know.

33 is the answer
7 0
3 years ago
In the Central City Grand Prix, out of 30 cars that started the race, 12 of them finished. what percent of the cars finished the
sveta [45]

Answer:40%

Step-by-step explanation: 12/30=.4

6 0
3 years ago
Which of the following is a solution of the equation 9- 2x=-1?<br> 04<br> 05<br> 04<br> 0-5
8_murik_8 [283]

Answer:

the answer is 5

Step-by-step explanation:

9-2x=-1. you subtract the 9 from both sides, giving you -2x=-10. then you divide the -10 by -2 which gives you 5

8 0
3 years ago
Read 2 more answers
The parabola opens upward has x = 2 as an axis of symmetry and contains the non -vertex points (1, 9) and (4, 27) write the equa
Sedaia [141]

Answer:

<h3>               f(x) = 6(x - 2)² + 3</h3>

Step-by-step explanation:

f(x) = a(x - h)² + k    - vertex form of the equation of the parabola with vertex (h, k)

"the parabola opens upward" means:  a>0

"the parabola has x = 2 as an axis of symmetry" means:  h = 2

so f(x) = a(x - 2)² + k

"the parabola contains the point (1, 9)" means:

9 = a(1 - 2)² + k

9 = a(-1)² + k

9 = a + k

k = 9 - a

"the parabola contains the point (4, 27)" means:

27 = a(4 - 2)² + k

so:

27 = a(2)² + 9 - a

27 = 4a + 9 - a

3a = 18

a = 6

and  k = 9 - 6 = 3

Therefore the vertex form for this parabola is:

                                     <u> f(x) = 6(x - 2)² + 3</u>

4 0
3 years ago
Other questions:
  • Last season two running backs on the Steelers football team rushed or a combined total of 1550 yards. One rushed 9 times as many
    13·1 answer
  • describe the steps you used to solve the equation and find the amount of carries allowance. linear equation: 1/4a+1/3a+8=22
    9·2 answers
  • Pouvez-vous m'aider s'il vous plaît? quelle est la racine carrée de 8 multipliée par la racine carrée de 67. merci pour votre ai
    9·1 answer
  • Meredith drew the shape shown below. A rectangle placed horizontally atop another vertically placed one. The dimensions of the r
    11·1 answer
  • List all possible permutations
    9·1 answer
  • Area=bh/2 <br><br> b=7ft<br> h=5ft <br> plz tell me what you got thz
    14·1 answer
  • 4 raised to power two minus 8u minus 9=0​
    14·2 answers
  • An altitude is drawn from the vertex of an isosceles triangle, forming a right angle and two congruent triangles. As a result, t
    10·1 answer
  • Determine the value of y is x is -10:<br> y=x-91+2
    5·1 answer
  • .<br><br> help me i don't know how to do this. (algebra 2)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!