Skip to main content

Posts

Showing posts with the label Write a Java program to create Simple Calculator using switch case.

ads1

Write a Java program to create Simple Calculator using switch case.

  Write a Java program to create Simple Calculator using switch case.  import java.util.*; class choice {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.out.println("Enter your Choice");         System.out.println("Press 1 for Add");         System.out.println("Press 2 for Sub");         System.out.println("Press 3 for Mul");         System.out.println("Press 4 for Div");         System.out.println("Press 5 for Mod");         int choice = in.nextInt();         switch(choice)         {             case 1:                 System.out.println("Enter the first number :-");                 int a = in.nextInt();                 System.out.println("Enter the first number :-");                 int b = in.nextInt();                 int add = a+b;                 System.out.println("The addition of two number is :-"+add);                  break;  

ads2