sábado, 26 de septiembre de 2009

deber 1 funciones

Andres Narvaez Naranjo
funciones

public class Funciones {
double valorX;
public double f2(double x){
valorX = x;
double g;
if (valorX<0){
g = x*x;
System.out.println("Respuesta = "+g);
}
if ((valorX>=0)(valorX<1))>
g= Math.sqrt(x);else
{g= x*(Math.sqrt(x));}
return f;
}public static void main(String[] args) {Funciones fun =new Funciones();System.out.println(fun.f2(-2));System.out.println(fun.f2(0.5));System.out.println(fun.f2(2));}

No hay comentarios:

Publicar un comentario