# HP Forums

Full Version: Ratio calculation command
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!!!
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :