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
Last one you guys!!!
Delicious77 [7]

Answer:

53 degree

Step-by-step explanation:

180-127=53.......

7 0
3 years ago
Read 2 more answers
Put these questions in order from least to greatest 3/8 19/24 2/3
aleksandr82 [10.1K]
First 3/8, second 2/3, and third 19/24
4 0
3 years ago
What’s the answer? To this I don’t get it help
Lady_Fox [76]

Answer:

2

Step-by-step explanation:

Hey There!

When it ask for the scale factor its asking for what did you have to multiply the side length by of figure a to get the similar side length of figure b

for example in figure A the base length is 7

to get the the base length of figure B (14) they multiplied the base length of figure A by 2

7x2=14

therefore the scale factor is 2

7 0
3 years ago
Ed is 7 years older than ted. eds age is also 3 over 2 times teds age. how old are ed and ted
Katyanochek1 [597]
Here you go!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

5 0
2 years ago
Hey! i’ll give brainliest please help.
xeze [42]
I think the answer is A sorry if I’m wrong
7 0
2 years ago
Other questions:
  • Which systems of equations have no solutions? (Check all that apply.)
    5·2 answers
  • Mary and tom park their cars in an empty parking lot with n ≥ 2 consecutive parking spaces (i.e, n spaces in a row, where only o
    11·1 answer
  • the lengths of three sides of a right triangle are three consecutive ecen integers. What are they ? Answer in order.
    9·1 answer
  • The area of a triangle is 1/2 (x^2 - 2x +2x^2 -4). The height h is x+2 Write an expression for the base b of the triangle. ( Hin
    5·1 answer
  • What’s the answer 3y+5&lt;10
    15·1 answer
  • What expressions are equal to 16.04
    12·1 answer
  • The table and graph both represent the same relationship.
    15·1 answer
  • What is 35% of 65 ? pls help
    15·2 answers
  • Mr. Evans is in charge of bringing soda for a party at his work. The store is selling 3 packs for $10. If he needs to bring 9 pa
    5·2 answers
  • If you apply the changes below to the absolute value parent function, f(x) = [X1,
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!