Details of this Paper

ECE 175 assignment 4




1.1 Determine the output of the following block of code (5 pts).;int x = 4, y = 9;x = x * 10;y = x - y;x = y/x;printf(?%d\t%d\t%f?, x, y, y/2.0);1.2 Write a block of code equivalent to the code below using a while loop instead of a for loop. Determine the values of i, x, N after the loop has terminated (5 pts).;int i, x = 4, N 5;for (i = 1, i 4 * x);j = 10;else if (i%j);j = 20;else;j = 30;1.4. Hand trace all values of i and m during the execution of the following for loop (5 pts);int i = 4, m = 8, i m;initial value;while (i > 0) 1 st iteration;{ 2 nd iteration;m /= 2,...;i -= 1,...;2. Code execution;2.1 Determine the output of the following program (5 pts).;#include;int main(void);int i, j;for (i = 0, i < 3, i++);for (j = 0, j 0);printf("%d, %d\n", i, 10*i);i-=2;3. Code composition;3.1 A geometric series is defined as a series of numbers with a constant ratio between successive terms. For example, in the series ?+1/4+1/8?, the ratio between two successive numbers is equal to ?.;Write a function named series_sum that computes the finite sum of the first n terms. Your function shall receive as input the ratio between successive terms and the number of terms to be added, and returns the series sum.


Paper#70004 | Written in 18-Jul-2015

Price : $27