We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents aa6bd34 + 6e0bf17 commit eede8bbCopy full SHA for eede8bb
1 file changed
Basic/Find LCM of Two Numbers/SolutionByGurirath.java
@@ -0,0 +1,24 @@
1
+
2
+/**
3
+ Write a program to print the lcm of two numbers.
4
+ */
5
+import java.util.*;
6
+public class SolutionByGurirath
7
+{
8
+ public static void main(String args[])
9
+ {
10
+ Scanner kb= new Scanner(System.in);
11
+ int i,n1,n2;
12
+ System.out.println("Enter two numbers to check their lcm");
13
+ n1=kb.nextInt();
14
+ n2=kb.nextInt();
15
+ for(i=2;i<Math.max(n1,n2);i++)
16
17
+ if(n1%i==0 && n2%i==0)
18
19
+ System.out.println("The LCM is : "+i);
20
+ break;
21
+ }
22
23
24
+}
0 commit comments