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
Help me please I will mark brianlyest
joja [24]
I hope I helped! :) :) :)

6 0
3 years ago
5) 5x-4= 20<br> у = 3х - 12<br> solve
vredina [299]

Answer:

Step-by-step explanation:

5x-4=20

5x=24: x=24/5

y=3x-12

y=3(24/5)-12

y = (72-60)/5

y=12/5

6 0
3 years ago
I WILL GIVE BRAINLIEST!! I really need help with this question.
Annette [7]

Answer: x = 70, y = 110, z = 85

Step-by-step explanation:

If BE = CD, then using corresponding angles (are equal), x = 70

If x = 70, then 70+y = 180 (angles on a straight line)

y = 110

And z = 85 (corresponding angles again): angle ABE = angle ACD

7 0
3 years ago
Read 2 more answers
Help please! Thank you
Anna71 [15]
First thing to do is set up your equation:
45/x = 20/100
Cross multiply
4500 = 20x
And divide by 20

Answer: 225 people were surveyed 

6 0
3 years ago
Read 2 more answers
Need help!!!!!!!! HURRYYYY!!!!!!!!!
svetoff [14.1K]

Answer:

the answer is 168

Step-by-step explanation:

you multiply with by length and you get 168.

7 0
3 years ago
Read 2 more answers
Other questions:
  • PLEASE HELP ASAP!!!!
    6·1 answer
  • Between which pair of numbers is the exact product of 379 and 8.
    6·2 answers
  • Need some help pleaseee
    11·1 answer
  • Ana owns an airline and pays the airport $35.00 for each ticket sold. the amount Ana pays is given by f(x)=35x where x is the nu
    13·1 answer
  • [6+(12-8). 32 ] + 2 =
    8·1 answer
  • 5 times 6 plus 1 times 8 plus 9 times 54 times 8 times 24 times 98 divided by 200 times 800 divided by 653 times 5782470
    7·1 answer
  • P(x)=x^4 -2x^3 -11x +12x+36
    7·1 answer
  • What is the equation of the graph below?
    11·1 answer
  • Can someone help? I need it ASAP
    9·1 answer
  • 1.      If α and β are the zeroes of a polynomial such that α + β = -6 and αβ = 5, then find the polynomial. ​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!