Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset
Comments Off

Java Algorithme d’Euclide: déterminer le plus grand commun diviseur

 int,string,char,static, url, socket, url, socket, java
Download

/**
 * @(#)LeplusGrandDiviseurCommun.java
 *
 *
 * @author 
 * @version 1.00 2013/9/26
 */
 
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class LeplusGrandDiviseurCommun 
{
 
      public static void main(String[] argv) throws Exception
  {
    ScriptEngineManager manager = new ScriptEngineManager();
 
    ScriptEngine engine = manager.getEngineByName("js");
    String myJSCode = "function gcd(a,b) {\n" +
		"    //Write Code Here\n" +
		"    if(a==b)\n" +
		"        return a;\n" +
		"    else if(a>b)\n" +
		"        return gcd(a-b, b);\n" +
		"    else if(a<b)\n" +
		"        return gcd(a, b-a);\n" +
		"}\n"+
		"print(gcd(36,24));\n"+
		"print(gcd(24,8) == 8 )";
 
    System.out.println(engine.eval(myJSCode));
 
  }
 
 
}

Cet article Java Algorithme d’Euclide: déterminer le plus grand commun diviseur est apparu en premier sur .

----------------------------------------------------------------------------
Sex Cams Movable Theme