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
What are the domain and range of the function
____ [38]

Answer:

Step-by-step explanation:

I don't say u must have to mark my ans as brainliest but if it has really helped u plz don't forget to thank me my frnd..

8 0
3 years ago
Read 2 more answers
Find p(-4) and p(2) for the function p(x)=11x^5-11x^4-5x^2+15x-8
egoroff_w [7]

hi,

you must replace x by the number between parenthese.

I show you with the first one and let you do the second one

p(x) = 11x^5 -11x^4 - 5x^2 +15x-8

p(-4)  =   11 (-4)^5 - 11 (-4)^4 -5(-4)² +15(-4) -8

p(-4) =     11  ( -1024- 256) - 5*16 -60-8

p(-4) =   11 ( -1280) -80-60-8

p(-4)   =    - 14080 - 148

p(-4) =   - 14 228

7 0
3 years ago
12 bars of soap for $8.69
Deffense [45]
Wow… how is this a question? .-.
8 0
3 years ago
According to the info in the table, who is the fastest typist?
Anastaziya [24]

Answer:

shaquille

Step-by-step explanation:

she had the greatest rate of typing

8 0
3 years ago
Read 2 more answers
Put these numbers in order from greatest to least<br> 6/8, 0.12, and -0.25
Setler [38]
This is the answer -0.25,0.12,6/8
4 0
3 years ago
Other questions:
  • I need help with this one
    7·1 answer
  • (07.01 MC) A set of numbers is shown below: {0, 0.8, 1, 3, 6} Which of the following shows all the numbers from the set that mak
    10·1 answer
  • It's going to be Lindsay's birthday soon, and her friends Martin, Sylvia, Tad, and Yvonne have contributed equal amounts of mone
    7·1 answer
  • Please help!!!! Brainliest worth 15 points
    11·2 answers
  • Mark has a container in the shape of a cube. He uses 64 cubes with side lengths of 1 inch to completely fiil the container. What
    13·1 answer
  • Evaluate 17-14÷(-2)+(-1)
    10·2 answers
  • A rectangle has a perimeter of 18. The height of the rectangle is 4 cm. What is the area of the rectangle?
    15·2 answers
  • Find the area of the triangle, please hurry and show your work
    9·2 answers
  • PLS HELPPPPPP NOWEW!!!!
    5·1 answer
  • Solve pls brainliest
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!