Question: Develop a flowchart and pseudocode for each programming question and include as part of your submission. Provide the source code in your submission with proper

Develop a flowchart and pseudocode for each programming question and include as part of your submission.

Provide the source code in your submission with proper indentation, label use, commenting and layout for each programming question.

Thanks

Develop a flowchart and pseudocode for each programming question and include as

5. One approach to functional debugging is to collect input and output data for the software for typical input values. In particular we define a set of input values, run the software, and record the output data generated by the software. In this exercise we will test the software using input values from 0 to N-1, where Nis 25. Consider the function sum (n) to test. The claim is that this function calculates the sum of the numbers N down to 1. For example sum (5) is 5+4+3+2+1 which equals 15. Furthermore, we will also test the hypothesis that the sum of N numbers can be expressed as the simple calculation of (N(N+1)V2. The test program will evaluate the function sum (n) and store the result in the array at sumBuf [n]. We need to define a second function fun (n) that simply calculates (N(N+1))/2. We have another array funBuf that we will use to store the first 25 calculations of this second function. We will check in the main program for equivalence of the two functions by comparing elements of sumBuf to the elements of funBuf. The main function should set a flag value based on the outcome of this comparison. In a top-down approach, we place the main program on the top and the functions after. In this example, we will configure the system as bottom up by placing the functions first and the main program at the end. Notice that bottom up organization does not need prototypes for the functions. Following C program template with code fragments are given to help you get started #define TRUE 1 #define FALSE 0 #define N 25 /l array size unsigned long sum(unsigned long n) unsigned long partial, count unsigned long fun(unsigned long n) Page 3 of 4 int main(void) unsigned long num unsigned long sumBufiN], funBufN I arrays to store computed values int correctFlag s: sum, fun ) and main in a bottom-up layout in a Write the C code with following single source code file as an embedded application. Note that function definitions precede the main function in a bottom-up layout and therefore not requiring function prototype declarations as given in the above template As a secondary method of verification for equivalence of two computations, use Keil/uVision to verify that sum (n) and fun (n) functions compute the same values by comparing values stored in the sumBuf and funBuf arrays using appropriate windows in the debugger

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!