-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.java
44 lines (33 loc) · 1.17 KB
/
main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package hoja3.hoja3;
import java.util.Scanner;
/**
*
* @author Eloy
*/
public class Ejercicio4 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
/*4. Dado el siguiente polinomio de segundo grado: y=ax2+bx+c crea un programa
que pida los coeficientes a, b y c, así como el valor de x, y calcula el valor
correspondiente de y.*/
int a;
int b,c,x;
Scanner entrada=new Scanner(System.in);
System.out.println("Introduce el valor de a ");
a=entrada.nextInt();
System.out.println("Introduce el valor de b ");
b=entrada.nextInt();
System.out.println("Introduce el valor de c ");
c=entrada.nextInt
System.out.println("Introduce el valor de x ");
x=entrada.nextInt();
int y= (int) ((a*Math.pow(x, 2))+b*x+c);
System.out.println("El resultado de la ecuacion es: "+y);
}
}