martes, 24 de mayo de 2016

Muestre un algoritmo que nos permita evaluar la funcion:


Muestre un algoritmo que nos permita evaluar la funcion:

//x^2+1,si x<=8

// f(x) x^2 + 3x + 2,si 0
// x + 1,si x>=3


import java.io.*;

class problm_10{

public static void main(String args[])throws IOException

{

double x,y;

BufferedReader in=new BufferedReader (new InputStreamReader(System.in));

System.out.println("Ingrese x ");

x = Double.valueOf(in.readLine().trim()).doubleValue();

if(x&lt;=0){

y = x*x+1;

}

else {

if(x&gt;=3){

y = x+1;

}

else{

y = (x*x+3*x+2);

}

}

System.out.println("La funcion vale " + y + " cuando x vale " + x);

}

}

No hay comentarios:

Publicar un comentario

ENTRADAS POPULARES