GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java/Programs/Calculator.java at main · arshcoder13/Java

Expand file tree

/

Calculator.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
51 lines (40 loc) · 1.47 KB
/

Calculator.java

Copy path

File metadata and controls

51 lines (40 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
45
46
47
48
49
50
51
/*
Make a Calculator.
Take 2 numbers(a&b)from the user and an operation as follows:
1:+(Addition)a+b.
2:-(Subtraction)a-b.
3:*(Multiplication)a*b.
4:/(Division)a/b.
5:%(Moduloorremainder)a%b.
Calculate the result according to the operation given and display it to the user.
*/
package chapter3sol;
import java.util.*;
public class s1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter First Number: ");
double a = sc.nextDouble();
System.out.println("Enter Second Number: ");
double b = sc.nextDouble();
System.out.print("choose one: \n 1. For Addition\n 2. For Substraction\n 3. For Multiplication\n 4. For Division\n 5. For Modulation \n : ");
int n = sc.nextInt();
switch (n) {
case 1:
System.out.println("Addition: "+(a+b));
break;
case 2:
System.out.println("Substraction: "+(a-b));
break;
case 3:
System.out.println("Multiplication: "+(a*b));
break;
case 4:
System.out.println("Division: "+(a/b));
break;
default:
System.out.println("Plz Choose Right Option");
break;
}
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.