The specifics depends on how your program is structured, which you haven't posted, or described in the detail that's needed.
Post your program's code, and give us an example of what you want to do:
*input you have
*processing you want
*output you want
Please, not just a description - but an actual example. Normal language is poor at communicating these kinds of details. Any math is fine as well, of course.