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.

Respuesta :

Answer:

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 <stdio.h>

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.