Why So Scared

A blog about; Programming, Music and Random Stuff

Java Greatest Common Divisor – Method

1
2
3
4
5
6
7
8
9
10
11
12
13
public class cis229wk3 {
	 static long gcd(long m, long n) {
		   if (n==0)
		     return m;
		   else
		     return gcd(n, m % n);
	} 

	public static void main(String [] args) {
		System.out.println(gcd(4,8));
		// program returns a 4
	}
}
posted by Juo in Java and have Comment (1)

One Response to “Java Greatest Common Divisor – Method”

  1. JORDAN says:

    Pillspot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.PillSpot.org. Vitamins@buy.online” rel=”nofollow”>.…

    Categories: Skin Care.Anti-allergic/Asthma.Womens Health.Mental HealthPain Relief.Eye Care.Antiviral.Blood Pressure/Heart.Anxiety/Sleep Aid.Antibiotics.Antidiabetic.Stop SmokingAntidepressants.Stomach.Vitamins/Herbal Supplements.Weight Loss.Mens H…

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment