Skip to content

Commit

Permalink
Merge pull request #1891 from Madanaa/patch-1
Browse files Browse the repository at this point in the history
Create 9thOct_Madanaa.java
  • Loading branch information
vibrantachintya authored Oct 12, 2021
2 parents d4f12c0 + 7528e2d commit 883f9b7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions JAVA/2021/9thOct_Madanaa.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.util.Scanner;
public class Main {
static int factorial(int x)
{
if (x <= 1)
return 1;
int res = 2;
for (int i = 3; i <= x; i++)
res = res * i;
return res;
}

static int gcdFactorial(int m, int n)
{
int min = m < n ? m : n;
return factorial(min);
}


public static void main (String[] args)
{

Scanner sc = new Scanner (System.in);
int m = sc.nextInt();
int n = sc.nextInt();
System.out.println(gcdFactorial(m, n));
}
}

0 comments on commit 883f9b7

Please sign in to comment.