Test 1 C Programming Session A

  1. Program 1: (50 points)

    In this program you will find a total price of the purchase based on the following rule: items priced a 100 dollars and below receive 15% discount. All other items receive 25% discount. Write a program that reads a sequence of positive integers, first negative or zero terminates the input. Each input represents the price of one item. The program finds:
    1. the total purchase price based on the rule above
    2. the average price per item
    3.the number of items bought

  2. Program 2: (50 points)

    Vitamin D is an important vitamin. The following table shows serum concentrations of the Vitamin D and correspondent health status:

    Vitamin D serum concentrations (integer) Health Status
    11 or less Very Deficient
    12 - 19 Deficient
    20 - 49 Adequate for bone and overall health
    50 or above Overdose, High level, potential health risk

    Write a program that first reads the number of people who came to the lab for Vitamin D testing. For each person, the program reads the Vitamin D level in the blood test. The program finds the number of people who are: very deficient, deficient, adequate and overdose.