29 gen 2014

Informatica

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author MAJORANA
 */
public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int a[]=new int [2];
        int b[]=new int [2];
        int c[]=new int [2];
        for (int i=0; i        {
            a[i]=(int) (Math.random()*10);
            b[i]=(int) (Math.random()*10);
            c[i]=(int) (Math.random()*10);
            System.out.println(a[i]+" "+b[i]+" "+c[i]);
        }
        int d,dx,dy;
        d=(a[0]*b[1])-(a[1]+b[0]);
        System.out.println("Ds="+ d);
        dx=(c[1]*b[0])-(c[0]+b[1]);
        System.out.println("Dx="+ dx);
        dy=(a[0]*c[1])-(a[1]+c[0]);
        System.out.println("Dy="+ dy);
        if (d!=0)
        {
              System.out.println("determinata");
        }else{
            if ((d==0) && (dx!=0) || (dy!=0))
        {
             System.out.println("impossibile");
        }else{
                if ((d==dx)&&(dy==0)&&(dx==dy))
                {
                      System.out.println("indeterminata");
                }
            }
           
            }
    }
}

Nessun commento:

Posta un commento