JAVA PROGRAM USING COMMAND LINE ARGUMENTS

import java.io.*;
import java.util.*;
public class Cmdline
{
  public static void main(String[] args)
  {
   int i,sum=0,big=-999;
   for(i=0;i<args.length;i++)
   {
    int c=(Integer.parseInt(args[i]));
   
    sum=sum+c;
    if (c > big) big=c;
   
    }
    System.out.println("sum of the command line arguments="+sum);
    System.out.println("The biggest element="+big);
   
   }
}



SAMPLE OUTPUT:

No comments:

Post a Comment