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
luda_lava [24]
3 years ago
8

. Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it should keep a

sking the user for a valid number. The program computes and prints at the end two things:
a.The sum of the numbers from 1 to n.
b.The average of the numbers from 1 to n.
Computers and Technology
2 answers:
Arlecino [84]3 years ago
8 0
The sum of the numbers from 1 to ñ
vazorg [7]3 years ago
4 0
A. the sum of the numbers from 1 to n
You might be interested in
Given the following function definition:
neonofarm [45]

The question is incomplete! Complete question along with its step by step answer is provided below!

Question:

Given the following function definition:

void calc (int a, int& b)

{

int c;

c = a + 2;

a = a * 3;

b = c + a;

}

x = 1;

y = 2;

z = 3;

calc(x, y);

cout << x << " " << y << " " << z << endl;

What is the output of the following code fragment that invokes calc?

a. 1 2 3

b. 1 6 3

c. 3 6 3

d. 1 14 9

e. None of these

Answer:

b. 1 6 3

Explanation:

In the given problem we have a function void calc which takes two input arguments a and b and updates its values according to following equations

c = a + 2;

a = a * 3;

b = c + a;

Then we call this function calc(x,y) by providing test values of

int x = 1;

int y = 2;

int z = 3;

and the output returns the values of x, y and z

cout << x << " " << y << " " << z << endl;

Lets find out what is happening here!

When the program runs we provide x=a=1 and y=b=2

c=a+2=1+2=3

a=a*3=1*3=3

b=c+a=3+3=6

So the updated values of a=x=3 and b=y=6?

NO!

The updated values are a=x=1 and b=y=6

WHY?

There are two ways to pass values

1. Pass by values -> value cannot change  (int a)

2. Pass by reference -> value can change (int& b)

Look at the function void calc (int a, int& b) ;

Here we are passing (int a) as a value and (int& b) as a reference, therefore x remains same x=1 and y gets changed to updated value y=6 and z remains same as z=3 since it wasnt used by function calc(x,y)

The right answer is:

b. 1 6 3

x=1, y=6, z=3

4 0
3 years ago
A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
My name is Ann [436]

Answer:

The maximum value that are represented as unsigned n -bit binary integer is 2^n-1. The unsigned binary integer refers to the fixed point of the system that does not contain any fractional digits.

The unsigned binary integer contain module system with the power 2. The number of student table in the class is the best example of the unsigned integer. The numbers can be represented by using the binary notation and bits in the computer system.

5 0
3 years ago
Find the gear ratio of the gear in the picture. <br><br> 25 points+brainliest
ankoles [38]

The gear ratios would look like A:B=1:9 and C:D=1:32 if you are just needing the gear teeth ratio. Not a lot of information to go off of from the question though

8 0
3 years ago
In reference to computer communications, what does the term noise mean?
jeka94
Noise usually means static.
6 0
3 years ago
Read 2 more answers
Which of the following plug-ins was developed by microsoft and is a software development tool used to write and run internet app
Elodia [21]
I'm not a hundred percent sure but maybe silverlight?
5 0
3 years ago
Other questions:
  • In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sid
    10·1 answer
  • Design and write an object-oriented program for managing inventory bins in a warehouse. To do this you will use two classes: Inv
    5·1 answer
  • What is the most effect way to include space after each paragraph
    14·1 answer
  • What is being measured using kbps, mbps, and gbps?
    7·1 answer
  • If you are working on a document and want to have Word automatically save the document every minute, what steps should you use t
    13·1 answer
  • Write a program that scores a blackjack hand. In blackjack, a player receives from two to five cards. (The player decides how ma
    5·1 answer
  • The CSS property of top , bottom , left , or right moves the element the specified distance from the respective edge of the clos
    7·1 answer
  • Which terms means device that converts one voltage to another ?
    15·1 answer
  • Explain the following terms <br><br>copyleft:<br><br>creative Commons:<br><br>GNU/GPL:​
    8·1 answer
  • Pls help I don’t know the answers
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!