package com.sudhirtheindian2.java123;
import java.util.Scanner;
public class calculater {
public static void main(String[] args) {
// How to make a calculater in java language
int a,b,c,choice;
System.out.println("enter two number");
Scanner scanner = new Scanner(System.in);
System.out.println("enter your first number");
a=scanner.nextInt();
System.out.println("enter your second number");
b=scanner.nextInt();
System.out.println("enter your choice");
choice= scanner.nextInt();
switch (choice){
case 1:
c=a+b;
System.out.println("addition "+c);
break;
case 2:
c=a-b;
System.out.println("subtraction "+c);
break;
case 3:
c=a*b;
System.out.println("multiplication "+c);
break;
case 4:
c=a/b;
System.out.println("devide "+c);
break;
case 5:
c=a%b;
System.out.println("remainder "+c);
break;
default:
System.out.println("this is wrong choice");
break;
}
}
}
Computer Storage Units Converter Computer Storage Units Converter From: Bytes Kilobytes Megabytes Gigabytes Terabytes Value: To: Bytes Kilobytes Megabytes Gigabytes Terabytes Convert
टिप्पणियाँ
एक टिप्पणी भेजें