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
HELPP will give brainiest!! ofccc I NEED THISS FASTT
seropon [69]

Answer:

can you put more iformation bc i wont be able to do stuff with out more imformation.

Step-by-step explanation:

7 0
2 years ago
Read 2 more answers
The second term of a GP is 18 and the fifth term is 486 find the first term and the common ratio​
valentina_108 [34]

Step-by-step explanation:

everything can be found in the picture

5 0
3 years ago
The bottom shape is a square prism with base edges of 5 feet and a height of 15 feet. What is the volume of the composite figure
alina1380 [7]
If the base of the prism is five an all sides with a height of 15 the volume would be  375 for the prism

if the pyramid has a base width and length of five, like the prism, it would have a volume of 25

the whole shape/construct together has a volume of 400ft^3
7 0
3 years ago
Read 2 more answers
Determine which sets of lengths can form a right triangle.
Alex17521 [72]

Answer: 50,40

Step-by-step explanation:

because a right angle is 90 degress

6 0
3 years ago
Read 2 more answers
Write (26 + 16i) − (26 − 7i) as a complex number in standard form. A. 52 − 9i B. 52 − 23i C. -9i D. 23i
nikitadnepr [17]

Answer:

D.  23i.

Step-by-step explanation:

(26 + 16i) − (26 − 7i)

Using the distributive law this becomes:

26 + 16i - 26 + 7i

Adding like terms:

= 0 + 16i + 7i

= 23i  (answer).

6 0
3 years ago
Read 2 more answers
Other questions:
  • Work out the percentage to change to decimal places when a price of 200 is increased to 210.99
    8·1 answer
  • I need help asap! Please.
    11·1 answer
  • Joseph wants a television for his
    13·2 answers
  • Use the information in the diagram to determine the height of the tree to the nearest foot
    6·2 answers
  • Oliver deposited $1,640.70 in a savings account that earns 2.6% simple interest. What will Oliver's account balance be in 8 mont
    8·1 answer
  • If 6 inches of decorative ribbon costs $3.25 ,how much does a yard cost?
    9·2 answers
  • There were 18 grey wolves after three years there were 27 grey wolves what is the percent increse
    6·2 answers
  • R is divided into 8 equal sections, and each section contains a number from 1 to 8. What is the probability of the spinner landi
    15·1 answer
  • Which rule describes the translation below? A. (x,y) = (x-5,4-3) B. (x,y) → (X+5.7+3) C. (x,y) → (X-3.y-5) D. (x,y) • (x+3,y +5)
    10·1 answer
  • Which is vertical line?<br> A) y=7x<br> B) y=7<br> C)=7
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!