unit 05 version D eev9ee

# unit 05 version D eev9ee - #include...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 1) A) The Function declaration for this program is: int getNumber(int) A function declaration does take a semicolon at the end. B) int C) yes D) int getNumber(int iArgNumber) E) getNumber(6) 2) #include <stdio.h> #include <stdlib.h> int main(void) { float x, y double output printf("Please input a number for X\n") printf("Please input a number for Y\n") output = ((x)*(x))+ (1/(y))- ((2)*(x)*(y)) if ( x > 0) { printf("f(x,y) is 5") } else { printf ("f(x,y) is %f \n", output) } getchar() getchar() return (0) r } 3) #include <stdio.h>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #include &lt;stdlib.h&gt; #include &lt;math.h&gt; void Sum (float iMax) Sheet1 Page 2 main(void) { float iMax int max printf(&quot;Please input the maximum vaule iMax: &quot;) scanf(&quot;%f&quot;,&amp;iMax) Sum(iMax) getchar() getchar() return 0 } void Sum (float iMax) { float x = 0 float y = 0 float sum = 0 float partial_sum = 0 for (x = 0 x &lt;= iMax x++) { partial_sum = x for (y = x y &gt; 1 y--) { partial_sum = x*partial_sum } if ((int) x % 2 == 0) { partial_sum = partial_sum * (-1) } sum = partial_sum + sum } printf(&quot;%.0f&quot;,sum) }...
View Full Document

## unit 05 version D eev9ee - #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online