--> //initializations

--> Ms=3.52//N (moist soil weight)
 Ms  = 

   3.52


--> Mr=2.9//N (reduce weight of soil)
 Mr  = 

   2.9


--> G=2.65// (specific gravity)
 G  = 

   2.65


--> Gm=1.85// (mass specific gravity)
 Gm  = 

   1.85


--> Yw=10//KN/m^3 (unit weight of water)
 Yw  = 

   10.


--> //calculations

--> Ww=Ms-Mr // (weight of water)
 Ww  = 

   0.62


--> w=Ww/Mr //(water content)
 w  = 

   0.2137931


--> Y=Gm*Yw //(unit weight)
 Y  = 

   18.5


--> Yd=Y/(1+w) //(dry unit weight)
 Yd  = 

   15.241477


--> e=((G*Yw)/Yd)-1 //(void ratio)
 e  = 

   0.7386766


--> n=(e*100)/(1+e) //(porosity)
 n  = 

   42.484991


--> S=(w*G*100)/e //(degree of saturation)
 S  = 

   76.698208


--> //results

--> printf('water content=%f',w) 
water content=0.213793
--> printf('void ratio=%f',e)
void ratio=0.738677
--> printf('porosity=%f',n) //%
porosity=42.484991
--> printf('degree of saturation=%f',S) //%
degree of saturation=76.698208
