Question: Chapter 9 2. Suppose that the function f has the following definition: int f(int a, int b) { ... } Which of the following statements

Chapter 9

2. Suppose that the function f has the following definition:

int f(int a, int b) { ... }

Which of the following statements are legal? (Assume that i has type int and x has type double.)

(a) i = f (83, 12) ;

(b) x = f (83, 12) ;

(c) i = f (3.15, 9.28) ;

(d) x = f (3.15, 9.28) ;

(e) f (83, 12) ;

Write your answer here:

2.

Programming Projects

9.1

1. Write a function check (x, y, n) that returns 1 if both x and y fall between 0 and n - 1, inclusive. The function should return 0 otherwise. Assume that x, y and n are all of type int.

1. Write your program here:

#include

int main(){

return 0;

}

2. Write a function digit (n, k) that returns the kth digit (from the right) in n (a posi- tive integer).

For example, digit(829, 1) returns 9, digit(829, 2) returns 2, and digit (829, 3) returns 8.

If k is greater than the number of digits in n, have the function return 0.

2. Write your program here:

#include

int main(){

return 0;

}

3. Write a function day_of_year (month, day, year) that returns the day of the year (an integer between 1 and 366) specified by the three arguments.

3. Write your program here:

#include

int main(){

return 0;

}

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!