![]() |
VOOZH | about |
Given two numbers a and b, where 'b' is incremented or decremented by some percentage of 'a'. The task is to find out that percentage.
Examples:
Input: a = 20, b = 25 Output: 25% Difference between 20 and 25 is 5, which is 25 % of 20. (+ve sign indicate increment) Input: a = 25, b = 20 Output: -20% ( -ve sign indicate decrement)
Formula to calculate percentage:
(Percentage2 - Percentage1) * 100 / (Percentage1)
25%
Time Complexity: O(1)
Auxiliary Space: O(1)