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
If someone could help me, it’d be great!
ryzh [129]
ABC has
A as the first letter
B as the second letter
C as the third letter
The order is important

Similarly with EFG we hae
E as the first letter
F as the second letter
G as the third letter
The order is also important

Based on the orderings, we can say
A corresponds to E
B corresponds to F
C corresponds to G

Which means
A rotates to E
B rotates to F
C rotates to G

The final answer is choice C) Angle C
since we're looking for the angle that rotates or maps to angle G
8 0
3 years ago
Juan is 3 times as old as Carmen. Together, their ages add up to 24. How old is each person?
Wittaler [7]

Carmen is six. Juan is eighteen.

6 0
3 years ago
Read 2 more answers
Which relation represents a function?
Tom [10]
C is the rigth answer because all the other three has two x values in common. :)
8 0
3 years ago
Solve each Inequality. Write your answer 2.) x + 9 &gt; 16 o​
MrRissso [65]

Answer:

o< 1/16x + 9/16

Step-by-step explanation:

x+9>16o

Flip the equation.

16o<x+9

Divide both sides by 16.

16o/16 < x+9/16

o< 1/16x + 9/16

5 0
3 years ago
15. What is the width of each bin? (1 point)
Pavel [41]
15) Answer is B because you can clearly see it's only 1 inch
5 0
3 years ago
Other questions:
  • What's the transformation of √x
    6·1 answer
  • A store is selling cookies for $8 for 12 bags .how much will it cost if you want to buy 30 for class and a gallon of milk for $4
    10·2 answers
  • Percy paid 24.10 for a basketball. The price of a basketball was 22.99. What was the sales tax rate?
    5·2 answers
  • Maani lai<br>1.8x = 4.68​
    10·1 answer
  • The first three steps for solving the quadratic equation by completing the square are shown. Fill in the missing number in the l
    11·2 answers
  • A box is filled with 14 green cards, 2 yellow cards, and 2 red cards. A card is chosen at random from the box. What is the proba
    7·1 answer
  • Find 5/6(−4 x 2/7). Write your answer in simplest form.
    8·2 answers
  • A blender was originally sold for $90 and has been marked down to $79.20. What is the percentage of discount for the blender
    7·1 answer
  • Helppppppppppppppppppppppppppppppppppppppppppppp
    14·1 answer
  • Mariana has 6 3/4 feet of border in all. Each piece is 3/8 of a foot long. How many pieces of border does she have?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!