This Java program prompts the user to input values for C1 and C2 in order to calculate the solution to the equation C1x + C2 = 0. It takes the user input, divides C2 by C1 to find the value of x, and displays the solution in the form "X = -r" where r is the result of C2/C1.
This Java program prompts the user to input values for C1 and C2 in order to calculate the solution to the equation C1x + C2 = 0. It takes the user input, divides C2 by C1 to find the value of x, and displays the solution in the form "X = -r" where r is the result of C2/C1.
This Java program prompts the user to input values for C1 and C2 in order to calculate the solution to the equation C1x + C2 = 0. It takes the user input, divides C2 by C1 to find the value of x, and displays the solution in the form "X = -r" where r is the result of C2/C1.
/** * * @author PC */ /*import java.util.Scanner;*/ public class PROG02_Ejerc7 {
public static void main(String[] args){
System.out.println("Vamos a calcular la ecuación C1x+C2=0..."); Scanner s=new Scanner(System.in); System.out.println("Introduzca valor de C1: "); int C1=s.nextInt(); System.out.println("Introduzca valor de C2: "); int C2=s.nextInt(); int r=C2/C1; System.out.println("El resultado es: "+"X"+ " ="+" -"+r);