This program takes two arguments statically and operates arithmetic operation on this two. //please save this code as Prog2.java or download the given file and compile it with " javac Prog2.java " //After successful compilation run this with " java Prog2 " at CMD // Make sure you have java already //installed in your system CODE : : class Prog2 { public static void main(String m[]) { String s1=m[0]; int a=6,b=2; System.out.println("The two values are"); System.out.println("a="+a); System.out.println("b="+b); int c=a*b; System.out.println("The Multiplication is:"+c); c=a/b; System.out.println("The Division is:"+c); c=a+b; System.out.println("The addition is:"+c); c=a-b; System.out.println("The subtraction is:"+c); } } OUTPUT : : The two values are a=6 b=2 The Multiplication is : 12 The Division is : 3 The addition is : 8 The subtraction is : 6
Your comment will be posted after it is approved.
Leave a Reply. |
Hello friends, i am a CSE student and i am going to upload all the programs of various language which might be in your collage practical list or might help you in performing your practicals in lab. Archives
August 2015
Categories |