[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 128
  • Last Modified:

Program to find the value of x and y?

If 37.004 = 37 +(x/60)+(y/3600)
how would you write a perl program to find the value of
x and y
0
tomatocans
Asked:
tomatocans
  • 2
1 Solution
 
ozoCommented:
$x = (37.004 - 37)*60;
$y = 0;
#or, if x is supposed to be an integer
use POSIX;
$x = floor((37.004 - 37)*60+0.5);
$y = (37.004 - 37 - $x/60)*3600;
0
 
jhurstCommented:
This linear function does not have only one solution.  As such your request is impossible.  If there are two variables, x and y then you need two equations.
0
 
tomatocansAuthor Commented:
Thanks
0
 
ozoCommented:
> As such your request is impossible
Or extremely easy
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now