For this Question: For a certain event, the value of a favorable outcome is A and the total outcome is B. If the probability of this event is represented by p/q where p and q are coprime then what will be the value of p+q.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>Probability()</b> that takes integers A, and B as arguments.

Constraints:-
1 <= A <= B <= 10000Return the value of p+q.Sample Input:-
4 6

Sample Output:-
5

Sample Input:-
3 5

Sample Output:-
8, I have written this Solution Code: static int Probability(int A,int B){
int x=1;
for(int i=2;i<=A;i++){
    if(A%i==0 && B%i==0){
        x=i;
    }
}
A=A/x;
B=B/x;
return A+B;
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?