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.
Do write, but before you start, please explain what does swapping a number mean.
1. Accept the 2 numbers 2. Add the 2 numbers3. Compare answer with 54. If answer is greater than 5 subtract with 5 else give a error message.
#include int main(void){int a;for(a=100;a
12345 1234 123 12 1
Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.
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
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.
the answer will always be 5
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
prompt x floor(x + .5) -> x disp x
Divide the number by 100 and then multiply the answer by 5. add the number with the answer.
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.
we write 5 in roman number like this :- V
Do write, but before you start, please explain what does swapping a number mean.
5
The smallest 5 digit number you can write is 10000.
When you add zero to a number, the number does not change. Ex: 5+0=5 5+2+0=7