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
Radda [10]
3 years ago
15

A program to add two numbers in C++

Computers and Technology
1 answer:
Paladinen [302]3 years ago
7 0
I don't know if i understood correctly, but C++ can add numbers by using the + funciton. You could either use:
a = b + c
or
a = a + b
if you want to increment a variable.
You might be interested in
Write algorithm to find (a+b)^2=(a+b)*(a+b)​
Masja [62]

Answer:

Basically

(a+b)^2 = a^2 + b^2 + 2ab

Explanation:

steps

       1: start

       2: read a value

        3: read b value

        4: c=(a+b)*(a+b);

        5: print  c value

         6:end

3 0
3 years ago
IN EXCEL, File, menu , edit, insert are all located in ?
abruzzese [7]

Answer:

menu bar is the correct answer

hope it helps☺️

7 0
3 years ago
What is the number reason for conflict on a team?
Viefleur [7K]

Answer:

jvphcrx8cctiit9t9t9t

5 0
3 years ago
Fill in the missing step in the following deadlock situation. Two users from the local board of education are each running a pro
Softa [21]

Answer:

b. P2 requests drive 2 and gets it.

Explanation:

Two users from the local board of education are each running a program (P1 and P2), and both programs will eventually need two DVD drives to copy files from one disc to another. Only two DVD-R drives are available and they’re allocated on an "as requested" basis. Soon the following sequence transpires: P2 requests drive 2 and gets it.

7 0
3 years ago
A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. For example, if S is 5,15,-30,10,-5,
Sindrei [870]

Answer:

We made use of the dynamic programming method to solve a linear-time algorithm which is given below in the explanation section.

Explanation:

Solution

(1) By making use of the  dynamic programming, we can solve the problem in linear time.

Now,

We consider a linear number of sub-problems, each of which can be solved using previously solved sub-problems in constant time, this giving a running time of O(n)

Let G[t] represent the sum of a maximum sum contiguous sub-sequence ending exactly at index t

Thus, given that:

G[t+1] = max{G[t] + A[t+1] ,A[t+1] } (for all   1<=t<= n-1)

Then,

G[0] = A[0].

Using the above recurrence relation, we can compute the sum of the optimal sub sequence for array A, which would just be the maximum over G[i] for 0 <= i<= n-1.

However, we are required to output the starting and ending indices of an optimal sub-sequence, we would use another array V where V[i] would store the starting index for a maximum sum contiguous sub sequence ending at index i.

Now the algorithm would be:

Create arrays G and V each of size n.

G[0] = A[0];

V[0] = 0;

max = G[0];

max_start = 0, max_end = 0;

For i going from 1 to n-1:

// We know that G[i] = max { G[i-1] + A[i], A[i] .

If ( G[i-1] > 0)

G[i] = G[i-1] + A[i];

V[i] = V[i-1];

Else

G[i] = A[i];

V[i] = i;

If ( G[i] > max)

max_start = V[i];

max_end = i;

max = G[i];

EndFor.

Output max_start and max_end.

The above algorithm takes O(n) time .

4 0
3 years ago
Other questions:
  • Helppppppppppppppppppp
    11·1 answer
  • Which of the following Office Online apps is most effective for creating multi-media presentations
    15·1 answer
  • What is the Matlab command to create a vector of the even whole numbers between 29 and 73?
    11·1 answer
  • Write a function called first_last that takes a single parameter, seq, a sequence. first_last should return a tuple of length 2,wh
    14·1 answer
  • The hexadecimal number system uses alphabets A to F to represent values_ to _
    12·2 answers
  • In a gear system, when you gain torque you lose what?
    11·1 answer
  • what version of the internet do we use as an interactive social system in which users are able to interact with senders
    7·1 answer
  • The decimal number 3 is ___ in binary the 2s column plus the 1s column.
    11·1 answer
  • 1. Write a program to input four numbers and store them in variables.
    6·1 answer
  • Add Try/Catch error checking To make sure that the user enters valid values in your program. To catch negative values passed to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!