forked from srinathr91/TestJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSol.java
More file actions
29 lines (25 loc) · 379 Bytes
/
Sol.java
File metadata and controls
29 lines (25 loc) · 379 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Sol {
public static int method(int a,int b){
int x=0;
int y=0;
int ans=1;
while(x<=b){
if(y<=a){
y++;
x++;
ans=ans*y;
}
else if(y>a && x<=b ){
//y++;
x++;
ans=ans*x;
}
}
return x-y+1;
}
public void main(String[] args){
int val1=2;
int val2=122;
System.out.println(method(val1,val2));
}
}