answersLogoWhite

0

How do you write a program to add 5 number?

Updated: 11/1/2022
User Avatar

Imaniomoniyi

Lvl 1
11y ago

Best Answer

Writing a program to add 5 numbers follows the same design principles as any other program design:

In the first step, clarify the requirements. For example, you might want to raise the following questions:

Will the program always add exactly 5 numbers, or any number of numbers up to 5?

Will all N summands be known at the same time, or will the program be required to add one summand at the time, until all N summands are accumulated?

Will all N summands share the same data type, and if so, what is the shared data type?

How is the program expected to handle summands of different types and resolution?

How is the program expected to obtain its input (the number N, and the N summands), and how is the program expected to present its output (the sum)?

How is the program expected to respond to error conditions?

In the second step, design a solution and identify its limitations. For example, you might discover that the algorithm stops functioning once the sum reaches a certain value. You might want to specify the precision of the result, and limitations of the algorithm (for example, the fact that N must be five).

In the third step, you'd repeat steps 1 and 2 until you understand the requirements, and the person who plans to use your program is satisfied with its limitations.

In the fourth step, you'd draft an initial version of the program. This could be feature limited (for example, with limited error checking), but should demonstrate that the core algorithm works correctly. Since the program will need to interface with a human or other programs, this version should also demonstrate this interface, proving that the required inputs and outputs can be obtained and delivered as intended.

In the fifth step, you'd refine your program. This will typically include refined error checking and diagnostics, performance improvements, etc.

In the sixth step, the program is being tested, and errors are addressed. When necessary, this might require returning to step 1.

In the seventh step, you should always review the requirements and limitations again to ensure that these agreed facts remain true, and no further limitations were added or new requirements discovered.

Subject to the complexity of your program, other steps include the creation of documentation and training materials, legal research, patent filing, software installation and distribution, protection of your intellectual property, and some-such.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program to add 5 number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Who to write decimal number?

To write a decimal you go to the end of the whole number 5 for example and then you put a period (5.) then you add the rest of the decimal like 5.6


Can you give me a program that will compute number 1 to 5?

nr\m;laeoh9y0m g.qthnedxc In fortran: do i=1,5 write(6,*)i enddo stop end This program will write the numbers 1 to 5 on the screen.


1.Write a number down 1-9 2.Add this to the next higher number 3.Add 9 4.Divide by 2 5.subtract your starting number?

the answer will always be 5


Write a program in C to find the complex number of a given number?

There is no such thing; you seem to have misunderstood something.Any real number can be regarded as a complex number with zero imaginary part, eg.: 5 = 5+0i


Write a program that converts a decimal number to nearest integer?

prompt x floor(x + .5) -> x disp x


How do you you add 5 percent to a number?

Divide the number by 100 and then multiply the answer by 5. add the number with the answer.


How do you write 9 and 4 over 5 as an improper fraction?

To write 9 and 4/5 as an improper fraction, first multiply the whole number (9) by the denominator (5), which is 45. Then add the numerator (4) to get 49. Finally, write 49/5 as the improper fraction.


How do you write 5 in numeric number?

we write 5 in roman number like this :- V


Write a program to swap any number?

Do write, but before you start, please explain what does swapping a number mean.


How would you write an algebaic expression for the sum of a any number multiply by 3 add 2?

5


What is the smallest 5 digit number you can write?

The smallest 5 digit number you can write is 10000.


What happen when you add zero to a number?

When you add zero to a number, the number does not change. Ex: 5+0=5 5+2+0=7