0% found this document useful (0 votes)
9 views

1area Circulo Winston

The document contains code for two Java programs. The first program calculates the area of a circle given its radius. The second program performs basic arithmetic operations (addition, subtraction, multiplication, division) on two numbers input by the user and displays the results of each operation in separate messages.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

1area Circulo Winston

The document contains code for two Java programs. The first program calculates the area of a circle given its radius. The second program performs basic arithmetic operations (addition, subtraction, multiplication, division) on two numbers input by the user and displays the results of each operation in separate messages.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1Area Circulo

import javax.swing.JOptionPane; public class AreaCirculo { public static void main(String args[]) { double pi=3.1415, radio, area; String num; num=JOptionPane.showInputDialog("Ingrase radio"); radio=Double.parseDouble(num); area = pi*radio*radio; JOptionPane.showMessageDialog(null,"el radio es "+area); System.exit(0); } }

2operadores
import javax.swing.JOptionPane; public class Operadores { public static void main(String args[]) { double A, B, Suma, Resta, Multiplicacion, Division; String numA, numB; numA=JOptionPane.showInputDialog("Ingrase A"); A=Double.parseDouble(numA); numB=JOptionPane.showInputDialog("Ingrase B"); B=Double.parseDouble(numB); Suma = A + B; Resta = A - B; Multiplicacion = A * B; Division = A / B; //JOptionPane.showMessageDialog(null,"La suma es: " + Suma + "\n La resta es: " + Resta + "\n La multiplicacion es: " + Multiplicacion + "\n La division es: " + Division); JOptionPane.showMessageDialog(null,"La suma es "+Suma); JOptionPane.showMessageDialog(null,"La resta es "+Resta); JOptionPane.showMessageDialog(null,"La multiplicacion es: "+Multiplicacion); JOptionPane.showMessageDialog(null,"La division es: "+Division); System.exit(0);

} }

You might also like