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
-1/4+3/4 please help I feel dumb for not knowing but I’m trying
butalik [34]

Answer:

the answer is \frac{1}{2} or 0.5

Step-by-step explanation:

Try using Symbolab, I use it all the time it gives the correct answer and it gives good explanations.

5 0
3 years ago
. Number of whole numbers between 42 and 65 is _________.
galben [10]

Step-by-step explanation:

: The number of whole numbers lying between 42 and 65 is 22 (65 – 42 – 1 = 22). They are as follows 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, and 64.

5 0
3 years ago
The widths of two similar rectangles are 10 m and 15 m. What is the ratio of the perimeters? Of the areas?
vitfil [10]
Area and perimeter are in the ratio of 1:3. but if u mean to ask about the ratio of perimeters & areas of both triangles. the answer would be 1:1
6 0
3 years ago
Help me with Thursday ASAP please
MrRissso [65]

Answer:

a + 3

Step-by-step explanation:

Kim's age is always three more than Tom's age.

7 0
3 years ago
Match each equation to the line of best fit that it models.
egoroff_w [7]

By applying concepts of <em>linear</em> functions, the graphs are related to the following expressions:

  1. (4/7) · x + 2
  2. x + 2
  3. (1/7) · x + 2
  4. - (1/7) · x + 2
  5. - x + 2

<h3>How to match a line with a given linear function</h3>

Graphically speaking, lines are described by <em>linear</em> functions, a kind of polynomials of grade 1, whose standard form is presented below:

y = m · x + b     (1)

Where:

  • x - Independent variable
  • y - Dependent variable
  • m - Slope
  • b - Intercept

Please notice that the slope is represented graphically by the change in the y-variable divided by the change in the x-variable and the intercept is the location where the line passes through the y-axis. Hence, the <em>resulting</em> expressions are shown in this order:

  1. (4/7) · x + 2
  2. x + 2
  3. (1/7) · x + 2
  4. - (1/7) · x + 2
  5. - x + 2

To learn more on linear functions: brainly.com/question/9330192

#SPJ1

6 0
2 years ago
Other questions:
  • What is the value of a if (2a + 3) - 3/4 (4a - 8) = 7
    15·1 answer
  • What is 2/6 equal to
    8·2 answers
  • Calculate the unknown angles.
    8·1 answer
  • I don't understand what it is asking?
    13·1 answer
  • What is the absolute value of -4/5,1/2,0.2,and -0.5
    15·1 answer
  • I need help please<br> Thanks
    10·2 answers
  • Can i please have some help​
    13·1 answer
  • Help?? pleaseeeee cant fudge it out lol
    6·1 answer
  • PLS HELP ILL REWARD A LOT
    5·2 answers
  • PLEASE HELP ASAP NOW OMG GIVE BRAINLIST HELP PLEASEEEE
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!