The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Ratio calculation command
10-23-2016, 01:38 AM (This post was last modified: 10-23-2016 05:09 AM by simone_71.)
Post: #1
Ratio calculation command
Very often for work, but mostly because I'm used to always do so, I use the ratio calculation. I wrote a simple program that solves ratio calculation (a : b = c : d), and I want to share it with you here. The program automatically solve the equation for the term equal to zero.

Code:

//Ratio Function By Simone Selleri.
//Version 1.0 - October 2016
//This function solve a ratio equation (a:b=c:d)
//for the value equal to 0.
//
//SYNTAX:    ratio(a,b,c,d)
//Examples:    ratio(10,20,30,0) gives 60
//            ratio(10,20,0,60) gives 30
//            ratio(10,0,30,60) gives 20
//            ratio(0,20,30,60) gives 10
//any question mail to: simone.selleri@gmail.com
//
EXPORT ratio(a,b,c,d)
BEGIN
  a▶A;b▶B;c▶C;d▶D;
  "A/B=C/D"▶E2;
    CASE
      IF A==0 THEN SOLVE(E2,A);END;
      IF B==0 THEN SOLVE(E2,B);END;
      IF C==0 THEN SOLVE(E2,C);END;
      IF D==0 THEN SOLVE(E2,D);END;
    END;
END;

I hope will be useful!!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Ratio calculation command - simone_71 - 10-23-2016 01:38 AM



User(s) browsing this thread: 2 Guest(s)