All pastes #50293 Raw Edit

Divisors

public java v1 · immutable
#50293 ·published 2006-04-20 23:00 UTC
rendered paste body
public class Divisors {	public static int divisors(int n) {		int sqrt = (int) Math.floor(Math.sqrt(n));		for (int x = sqrt;; x--) {			if ((n % x) == 0)				return x;		}	}	public static void main(String[] args) {		int x = divisors(3000);		int y = 3000 / x;		System.out.println("3000: " + x + " " + y);	}}