Ask Question
9 October, 13:25

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.

+1
Answers (1)
  1. 9 October, 15:25
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers