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
myrzilka [38]
3 years ago
13

Write an algorithm and flowchart to calculate sum of two given numbers​

Computers and Technology
1 answer:
klio [65]3 years ago
7 0
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values for num1, num2.
Step 4: Add num1 and num2 and assign the result to a variable sum.
Step 5: Display sum
Step 6: Stop
#include
int main()
{
int num1,num2,sum;
printf("\n Enter the first number to be added: ");
scanf("%d",&num1);
printf("\n Enter the second number to be added: ");
scanf("%d",&num2);
sum = num1 + num2;
printf("\n The sum of two numbers is: %d",sum);
return 0;
}
You might be interested in
The Open Systems Interconnection (OSI) is a conceptual model whose purpose is to make networks more manageable. Its objectives i
andrew-mc [135]

Answer:

A. data-link layer

Explanation:

Data-link layer is the first layer and allows a contiguous sequence of bits to be transmitted through the network.

On top of it is the Network Layer and it handles the task of routing network messages from one computer to another.

Then comes the Transport Layer which is the basic layer at which one network computer communicates with another network computer.

6 0
3 years ago
What are smart mobile devices
Nezavi [6.7K]

portable computing tool

7 0
3 years ago
Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order. Write a static meth
telo118 [61]
Since both arrays are already sorted, that means that the first int of one of the arrays will be smaller than all the ints that come after it in the same array. We also know that if the first int of arr1 is smaller than the first int of arr2, then by the same logic, the first int of arr1 is smaller than all the ints in arr2 since arr2 is also sorted.

public static int[] merge(int[] arr1, int[] arr2) {
int i = 0; //current index of arr1
int j = 0; //current index of arr2
int[] result = new int[arr1.length+arr2.length]
while(i < arr1.length && j < arr2.length) {
result[i+j] = Math.min(arr1[i], arr2[j]);
if(arr1[i] < arr2[j]) {
i++;
} else {
j++;
}
}
boolean isArr1 = i+1 < arr1.length;
for(int index = isArr1 ? i : j; index < isArr1 ? arr1.length : arr2.length; index++) {
result[i+j+index] = isArr1 ? arr1[index] : arr2[index]
}
return result;
}


So this implementation is kind of confusing, but it's the first way I thought to do it so I ran with it. There is probably an easier way, but that's the beauty of programming.

A quick explanation:

We first loop through the arrays comparing the first elements of each array, adding whichever is the smallest to the result array. Each time we do so, we increment the index value (i or j) for the array that had the smaller number. Now the next time we are comparing the NEXT element in that array to the PREVIOUS element of the other array. We do this until we reach the end of either arr1 or arr2 so that we don't get an out of bounds exception.

The second step in our method is to tack on the remaining integers to the resulting array. We need to do this because when we reach the end of one array, there will still be at least one more integer in the other array. The boolean isArr1 is telling us whether arr1 is the array with leftovers. If so, we loop through the remaining indices of arr1 and add them to the result. Otherwise, we do the same for arr2. All of this is done using ternary operations to determine which array to use, but if we wanted to we could split the code into two for loops using an if statement.


4 0
3 years ago
Examine the following output:
zepelin [54]

Answer:

a. tracert

Explanation:

Tracert is a computer network diagnostic demand which displays possible routes for internet protocol network. It also measures transit delays of packets across network. The given output is produced by a tracert command.

8 0
3 years ago
In the world of computers, the term ____ refers to the computerâs physical components, such as the monitor, keyboard, motherboar
USPshnik [31]
The missing word there is hardware
6 0
3 years ago
Other questions:
  • In 1–2 sentences describe how you would insert a row in a spreadsheet.
    6·2 answers
  • Get these points why they hot!!!!!!!!!!!!!!!!!!!!
    14·2 answers
  • How to fix Please enable JS and disable any ad blocker
    13·2 answers
  • 14<br> Select the correct answer.<br> Which activity is a marketing technique?
    9·1 answer
  • The multitasking, multi-user, operating system developed by Bell Laboratories that operates on a wide variety of computing platf
    13·1 answer
  • lance measured 0.485 liter of water. Angel measured 0.5 liter of water. lance said, "My beaker has more water than yours because
    6·2 answers
  • What does remedy mean
    7·2 answers
  • Please help!
    10·2 answers
  • Que significa el término Informática?
    6·1 answer
  • jeff has just upgraded from windows 7 to windows 10 and he is confused. He has started several universal apps but he can't figur
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!