lab2_teedculculator:
/*
* To change this license header, choose
License Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package lab2_teedculculator;
/**
*
* @author HOANG LIHUO
*/
import java.util.Scanner;
public class Lab2_TeedCulculator {
/**
* @param
args
the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double a , b , sum , divide , subtract
, multiplied , remainder;
Scanner input = new Scanner(System.in);
System.out.print("a
= ");
a = input.nextDouble();
System.out.print("b
= ");
b = input.nextDouble();
// 3. Do the following Operations
// a. Sum A + B
sum = a + b;
System.out.println("a.
A + B =" +sum);//out sum
// b. Divide A / B
divide = a / b;
System.out.println("b.
A / B =" +divide);//out divide
// c. Subtract A - B
subtract = a - b;
System.out.println("c.
A - B =" +subtract);//out subtract
// d. Multiplied A*B
multiplied= a * b;
System.out.println("d.
A * B =" +multiplied);//out multiplied
// e. Remainder A % B
remainder = a % b;
System.out.println("e.
A % B =" +remainder);//out remainder
}
}
Comments
Post a Comment