<commit_before>package pck01;
import java.util.Scanner;

/**
 * @author <NAME>
 */

public class SolutionsTrinome {
    
    public static void main(String[] args) {
        System.out.println("Soit ax² + bx + c = 0");
        System.out.println(solTrinome(inputDouble("entrez a :"),inputDouble("entrez b :"),inputDouble("entrez c :"))) ;
    }
    
    public static String solTrinome(double a, double b, double c) {
        double d = b * b - 4 * a * c ;
        if (d>0) {
            return ("Racines réelles : " + (-b-Math.sqrt(d))/(2*a) + " et " + (-b+Math.sqrt(d))/(2*a));
        }
        else if (d==0) {
            return ("Racine double : " + -b/(2*a));
        }
        else {
            return("Racine complexes : " + -b/(2*a) + -Math.sqrt(-d)/(2*a) + "i" + " et " + -b/(2*a) + "+" + +Math.sqrt(-d)/(2*a) + "i");
        }
    }
    
    /* // Pour mémoire ...
    public static String inputString(String demande){
      Scanner sc = new Scanner(System.in);
      System.out.println(demande);
      //On vide la ligne avant d'en lire une autre
      sc.nextLine();
      String str = sc.nextLine();      
      return str;<commit_msg>Pb signes racines cplx résolu<commit_after>package pck01;
import java.util.Scanner;

/**
 * @author <NAME>
 */

public class SolutionsTrinome {
    
    public static void main(String[] args) {
        System.out.println("Soit ax² + bx + c = 0");
        System.out.println(solTrinome(inputDouble("Entrez a :"),inputDouble("Entrez b :"),inputDouble("Entrez c :"))) ;
    }
    
    public static String solTrinome(double a, double b, double c) {
        double d = b * b - 4 * a * c ;
        if (d>0) {
            return ("Racines réelles : " + (-b-Math.sqrt(d))/(2*a) + " et " + (-b+Math.sqrt(d))/(2*a));
        }
        else if (d==0) {
            return ("Racine double : " + -b/(2*a));
        }
        else {
            if (a<0) {
                return("Racine complexes : " + -b/(2*a) + "+" + -Math.sqrt(-d)/(2*a) + "i" + " et " + -b/(2*a) + +Math.sqrt(-d)/(2*a) + "i");
            }
            else {
                return("Racine complexes : " + -b/(2*a) + -Math.sqrt(-d)/(2*a) + "i" + " et " + -b/(2*a) + "+" + +Math.sqrt(-d)/(2*a) + "i");
            }
        }
    }
    
    /* // Pour mémoire ...
    public static String inputString(String demande){
      Scanner sc = new Scanner(System.in);
      System.out.println(demande);
      //On vide la ligne avant d'en lire une autre
      sc.nextLine();
      String str = sc.nextLine();      
      return str;
{'fraction_non_alphanumeric': 0.1894238358326756, 'fraction_numerical': 0.0122336227308603, 'mean_word_length': 1.9037800687285222, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6433873', 'n_tokens_mistral': 922, 'n_tokens_neox': 900, 'n_words': 201}