Ask Question
16 September, 19:07

You are given two variables, already declared and assigned values, one of type double, named totalWeight, containing the weight of a shipment, and the other of type int, named quantity, containing the number of items in the shipment. Write an expression that calculates the weight of one item.

+3
Answers (1)
  1. 16 September, 19:12
    0
    double singleWeight = totalWeight/quantity;

    Step-by-step explanation:

    Considering you already have two different declared and assigned variables, in C language you would have the following lines:

    #include

    int main ()

    {

    double totalWeight = 5.2;

    int quantity = 2;

    double singleWeight = totalWeight/quantity;

    / / Displays operation

    printf ("%f / %d = %f", totalWeight, quantity, singleWeight);

    return 0;

    }

    It is very important to keep in mind that the type of variable of singleWeight is double due to the expecting number is the result of the division where the dividend is double too.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “You are given two variables, already declared and assigned values, one of type double, named totalWeight, containing the weight of a ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers