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 the following system of equations by using the substitution method.
vampirchik [111]
There appears to be a typing error in the second equation. 

Still the answer is (7,10) because it is the only ordered pair that works for the first equation. 
8 0
3 years ago
Find the distance between the two points rounding to the nearest tenth (if necessary).
QveST [7]

The distance between two points having coordinates (4, -4) and (9, -2) plotted on the cartesian plane, and rounded to the nearest tenth, will be 5.40 units.

As per the question statement, two points having coordinates (4, -4) and

(9, -2) plotted on the cartesian plane.

We are required to calculate the distance between the above mentioned two points, rounded to the nearest tenth.

To solve this question,  we need to know the Distance-formula which goes as,

"The distance between any two points (x₁, y₁) and (x₂, y₂) can be given by √[(x₂ - x₁)² + (y₂ - y₁)²]"

Assuming that [(x₁, y₁) = (4, -4)] and [(x₂, y₂) = (9, -2)], and substituting these values in the above-mentioned distance formula, we get,

√[(9 - 4)² + {(-2) - (-4)}²]

= √[(9 - 4)² + {(-2) + 4}²]

= √[(9 - 4)² + (4 - 2)²]

=√[(5)² + (2)²]

=√(25 + 4)

=√29

= 5.38 units.

Therefore, rounding (5.38) to the nearest tenth, we get, 5.40.

That is, the distance between two points having coordinates (4, -4) and (9, -2) plotted on the cartesian plane, and rounded to the nearest tenth, will be 5.40 units.

  • Distance: In Mathematics, physics or daily life, distance is a numerical or occasionally qualitative measurement of how far objects or points are from each other.
  • Coordinates: In geometry, coordinates are a pair of numbers that can uniquely determine the position of points or other geometric elements on a Euclidean or Cartesian Plane.

To learn more about Distances and Coordinates, click on the link below.

brainly.com/question/14364020

#SPJ1

5 0
1 year ago
Find the complex number solutions to the quadratic f(x)=2x^2-6x+17
Katena32 [7]

Answer:

im pretty sure the answer is b. im not 100% though

Step-by-step explanation:

8 0
3 years ago
0.008 is 1/10 of what decimal?
Bas_tet [7]
The answer is .1 or .10
6 0
3 years ago
Prime factors of 24x2
Troyanec [42]

Answer:

Step-by-step explanation:

24 is a composite number.

Prime factorization: 24 = 2 x 2 x 2 x 3, which can be written 24 = 2³ x 3

The exponents in the prime factorization are 3 and 1. Adding one to each and multiplying we get (3 + 1)(1 + 1) = 4 x 2 = 8. Therefore 24 has exactly 8 factors.

Factors of 24: 1, 2, 3, 4, 6, 8, 12, 24

Factor pairs: 24 = 1 x 24, 2 x 12, 3 x 8, or 4 x 6

5 0
3 years ago
Other questions:
  • Determine each product.<br>a. (3+i)(3-i)<br>b. (4i-5)(4i+5)<br>c. (2i-4)(3i+2)
    9·1 answer
  • How do you solve<br> 4(6-x)=52
    14·2 answers
  • At the party after the tournament, Tom spent $0.65 for lemonade, $1.25 for a hot dog, and $0.95 for an apple. How much did he sp
    14·1 answer
  • If limit as x approaches a of f of x equals four and limit as x approaches a of g of x equals three, then limit as x approaches
    8·1 answer
  • Carlos bought watermelons for 2.55¢ each and apples for 35¢ each. He bought 8 more apples than watermelons and spent a total of
    6·1 answer
  • A certain bag contains only red balls, green balls, and blue balls and no other balls. The ratio of the number of red balls to t
    10·1 answer
  • Please help i don’t know if i got the right answer
    14·2 answers
  • Find the greatest common factor<br> of 6 and 8.
    8·1 answer
  • How do you find the radius of a circle?
    11·2 answers
  • Please answer number six PLEASE!
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!