Suma, resta, multiplicación y división

package operadores;

import java.util.Scanner;

/**
 * Arithmetic Operators: Operaciones de suma, resta, multiplicación y división.
 * 
 * @author Carlos del Cerro
 * @author www.carlos.com
 * @version 1.0
 */
public class Operadores1 {
 public static void main(String[] args) {
  caculateValues();
 }

 static void caculateValues() {

  int a, b;
  int resulta, results, resultm;
  float resultd;
  Scanner sc = new Scanner(System.in);
  System.out.print("Enter a:");
  a = sc.nextInt();
  System.out.print("Enter b:");
  b = sc.nextInt();

  resulta = a + b;
  results = a - b;
  resultm = a * b;
  resultd = a / b;

  System.out.println("The result of adding is: " + resulta);
  System.out.println("The result of subtracting: " + results);
  System.out.println("The result of multiplying is: " + resultm);
  System.out.println("The result of dividing is: " + resultd);
 }

0 comentarios:

Publicar un comentario