EEGR-409-001, C Language Programming, Fall, 09, Assignment #3

1.  Develop functions and test them using a main().

   int middle_3(int a, int b, int c);

For example middle_3(5 9 4) is 5.  Note that it is not the max and it is not the min.
   

2.  Develop and test a function taht calculates the number of seconds since midnight.

    int calc_secs(int hr, int mi, int se);
   

3.  Write a function;

     int num_digits(int number);

which returns the number of digits in a positive number.  For example, 9123 is four digits, 45 is two digits.


4.  Write a function;

     int digit(int number, int k);

which returns the kth digit (from the right).  For example if number is 6859 and if k is 2, the function should return 5.  If k is 3, the function should return 8.  If k is greater than the number of digits, the function should return -1.

       
5.  Develop two functions to evaluate the two roots of a quadratic equation.


float calc_root_1(float a, float b, float c);
float calc_root_2(float a, float b, float c);

Use this to evaluate;

    x^2 + 9 * x + 19 = 0 
    
   
6.  Fetch an array of numeric grades from a user and calculate the numeric average and letter grade.

float calc_avg(float g[], int num_grades);
char calc_letter_grade(float avg);