Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Clc.java
Language: JAVA
Code:
import java.util.*;



public class Clc
{
public static void main (String args [])
{
int i,j;
float d,m;
String op;
Scanner s1= new Scanner (System.in);

i= s1.nextInt();
System.out.println(" enter 1st no:"+i);

j= s1.nextInt();
System.out.println(" enter 2nd no:"+j);

op= s1.next();
System.out.println(" enter operator:"+op);

switch(op)
{
case "+":
System.out.println(" addtion:"+(i+j));break;

case "-":
System.out.println(" subtraction:"+(i-j)); break;
case "*":
System.out.println(" multiplication:"+(i*j)); break;
case "/":
d= (float)i/j;
System.out.println(" division:"+d); break;
case "%":
m= (float)i%j;
System.out.println(" modulo:"+m); break;
default:
System.out.println(" invalied operator");

}
}
}
Comments: