Code Box
---------------------------------
/*Program to add two numbers using command line argument 2 */
class add
{
public static void main(String x[])
{
int a,b,c;
System.out.print("\nzeroth argument :"+x[0]);
a=Integer.parseInt(x[0]);
//zeroth argument in a
System.out.print("\nvalue of a= "+x[0]);
System.out.print("\nfirst argument :"+x[1]);
b=Integer.parseInt(x[1]);
//first argument in b
System.out.print("\nvalue of b= "+x[1]);
c=a+b;
System.out.print("\nSum of a+b= "+c);
}
}
0 comments:
Post a Comment