Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions SCMethod1.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package scmethod1;

public class SCMethod1
{

int gcd(int m,int n)
{
while(m!=n)
{
if(m>n)m=m-n;
else n=n-m;
}
return m;
}

{
int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}

public static void main(String[] args)
{
SCMethod1 x=new SCMethod1();
Expand All @@ -26,7 +22,7 @@ public static void main(String[] args)

static boolean isPrime(int n)
{
for(int i=2;i<n/2;i++)
for(int i=2;i<=n/2;i++) // changed by equating to n/2
{
if(n%i==0)
return false;
Expand Down