Remainder Division

Author: Yuriy Tokman (YTG)
0 Views
0 Downloads
0 Favorites
Remainder Division
//+------------------------------------------------------------------+
//|                                           Remainder Division.mq4 |
//|                                               Yuriy Tokman (YTG) |
//|                       https://www.mql5.com/ru/users/satop/seller |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman (YTG)"
#property link      "https://www.mql5.com/ru/users/satop/seller"
#property version   "1.00"
#property strict
#property script_show_inputs

input int X = 10;
input int Y = 3;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   Print("Remainder Division = ",DoubleToString(RD(X,Y),Digits));
  }
//+------------------------------------------------------------------+
double RD(int x, int y)
  {
   if(x == 0 || y == 0)
      return(0.1);
   double z = (double)x / (double)y;
   return(z - int(z));
  }
//+------------------------------------------------------------------+

Comments