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
Two step equation<br><br> n - 5/2 =5
Verdich [7]

Answer:

Step-by-step explanation:

two step equation

n - 5/2 = 5

n = 5 + 5/2

n = 5 + 2.5

n = 7.5

-----------

check

7.5 - 5/2 = 5

7.5 - 2.5 = 5

5 = 5

the answer is good

3 0
1 year ago
The sum of three consecutive integers is 63. What is the lowest of the three integers?
sveta [45]
  One number be x
x+(x+1)+(x+2)=63
x+x+1+x+2=63
3x+3=63
3x=63-3
3x=60
x=60:3
x=20
smallest number = x=20
middle <span>number = x+1= 20+1=21
</span>largest<span><span><span> number = x+2</span> =20+2= 22</span>
</span>
3 0
3 years ago
What is -15x=0 solution
cricket20 [7]
Here is the method for solving that equation:

Step #1:  Write the equation:

             -15x = 0

Step #2:  Divide each side of the equation by -15 :

                 <u>x = 0</u>
3 0
3 years ago
Round each number to the nearest hundred thousand 179,426 2
vladimir1956 [14]
200,000 thousand is the answer kid.
4 0
3 years ago
Please help me. I need how to do the problem too
MatroZZZ [7]

Answer: Choice A.  (8, 4)

==========================================================

Explanation:

Because x = 2y, we can replace every copy of x with 2y

Let's do so in the second equation

3x - 4y = 8

3(x) - 4y = 8

3(2y) - 4y = 8 .... x replaced with 2y; now let's isolate y

6y - 4y = 8

2y = 8

y = 8/2 ..... divide both sides by 2

y = 4

Use this y value to find x

x = 2y

x = 2*4

x = 8

So we have x = 8 and y = 4 pair together to get the answer (x,y) = (8, 4) which is choice A.

5 0
2 years ago
Other questions:
  • Greatest common factor of 66 and 32
    5·1 answer
  • Write an expression that uses addition,subtraction, multiplication and division and only negative numbers that has the same valu
    9·1 answer
  • The planet Mercury measures 4,879 kilometers from one side to the other. Earth
    9·2 answers
  • The surface area of a cone is 43.75 what is the slant height of the cone ?
    6·1 answer
  • What is c=2πr solve for c
    6·2 answers
  • Find the HEIGHT of the rectangular prism given its surface area is 238 square yards.
    6·1 answer
  • (2x+y)(2x-y) what is this equation
    15·2 answers
  • Addmaths probability. I need helpp for question a and b thank youu
    5·1 answer
  • G(x)=1/6(8)^x-5. x=9​
    13·1 answer
  • What is 1/8 as a fraction decimal and percent<br>​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!