Commandline arguments

Commandline arguments

View Answers

June 24, 2009 at 10:47 AM

Hi Friend,

Try the following code:

import java.util.*;
public class SumAndAverage{
public static void main (String [] arg) {
Scanner scan = new Scanner (System.in);
int [] numbers = new int [10];
int sum=0;
System.out.print("Enter 10 numbers");
for (int i=0; i<numbers.length; i++) {
numbers[i]=scan.nextInt ();
sum+=numbers[i];
}
System.out.println("Sum of Numbers: "+sum);
System.out.println("Average of Numbers: "+sum/10);
}
}
Hope that it will be helpful for you.

Thanks









Related Tutorials/Questions & Answers:
Commandline arguments - Java Beginners
Commandline arguments  hi!My question is: Write a program to store the marks of 10 students in an array.Accept these marks as command line arguments and display their sum and average. Please respond as soon as possible.  
how to pass command line arguments in ant
how to pass command line arguments in ant  How to pass runtime values ie commandline arguments to a program written in java using ant tool
Advertisements
ModuleNotFoundError: No module named 'commandline'
ModuleNotFoundError: No module named 'commandline'  Hi, My Python... 'commandline' How to remove the ModuleNotFoundError: No module named 'commandline' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'commandline'
ModuleNotFoundError: No module named 'commandline'  Hi, My Python... 'commandline' How to remove the ModuleNotFoundError: No module named 'commandline' error? Thanks   Hi, In your python environment
JavaScript pass arguments
JavaScript pass arguments   How to pass dynamic arguments to the functions in JavaScript
ModuleNotFoundError: No module named 'arguments'
ModuleNotFoundError: No module named 'arguments'  Hi, My Python... 'arguments' How to remove the ModuleNotFoundError: No module named 'arguments' error? Thanks   Hi, In your python environment you
arguments evaluation - Java Beginners
arguments evaluation   i am not sure about the evaluation order of arguments in java. can any one tell me that arguments in java is evaluated left... the arguments evaluated in C C
mysql_connect arguments
mysql_connect arguments   How many arguments a mysql_connection... takes three arguments Server - localhost Username - admin Password - 1admin And if the given arguments are correct it will connect to the database and print
ModuleNotFoundError: No module named 'commandline-baseball'
ModuleNotFoundError: No module named 'commandline-baseball'  Hi...: No module named 'commandline-baseball' How to remove the ModuleNotFoundError: No module named 'commandline-baseball' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-baseball'
ModuleNotFoundError: No module named 'commandline-baseball'  Hi...: No module named 'commandline-baseball' How to remove the ModuleNotFoundError: No module named 'commandline-baseball' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-parsable'
ModuleNotFoundError: No module named 'commandline-parsable'  Hi...: No module named 'commandline-parsable' How to remove the ModuleNotFoundError: No module named 'commandline-parsable' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-parsable'
ModuleNotFoundError: No module named 'commandline-parsable'  Hi...: No module named 'commandline-parsable' How to remove the ModuleNotFoundError: No module named 'commandline-parsable' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-baseball'
ModuleNotFoundError: No module named 'commandline-baseball'  Hi...: No module named 'commandline-baseball' How to remove the ModuleNotFoundError: No module named 'commandline-baseball' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-parsable'
ModuleNotFoundError: No module named 'commandline-parsable'  Hi...: No module named 'commandline-parsable' How to remove the ModuleNotFoundError: No module named 'commandline-parsable' error? Thanks   Hi
ModuleNotFoundError: No module named 'commandline-baseball'
ModuleNotFoundError: No module named 'commandline-baseball'  Hi...: No module named 'commandline-baseball' How to remove the ModuleNotFoundError: No module named 'commandline-baseball' error? Thanks   Hi
Command line arguments
Command line arguments  Please explain me what is the use of "command line arguments" and why we need to use
Printing Command Line arguments in JRuby
# Printing commandline arguments 0.upto( "... Printing Command Line arguments in JRuby... we will discuss about printing command line arguments in JRuby program. We can
Passing Arguments. - Java Beginners
Passing Arguments.  Hi, im new in doing this passing arguments and calling methods. Can you please see that y im not getting the answer as the question says to do. Thanks Question:Write a method that is passed two arguments
function arguments in java
function arguments in java  function arguments in java   Command line argument in Java import java.util.*; public class SumAndAverage...); } } In the above code, the values of i and j are function arguments
Append Arguments to the URL
Append Arguments to the URL  Hi, How to append the query string to the Current Url when i click on a link. AM using Spring MVC i.e. My URL : http://localhost:8080/Sample/SampleApp?id=1 In my page having multiple links (a href
COMMAND LINE ARGUMENTS
COMMAND LINE ARGUMENTS  JAVA PROGRAM TO ACCEPT 5 COMMAND LINE ARGUMENTS AND FIND THE SUM OF THAT FIVE.ALSO FIND OUT LARGEST AMONG THAT 5   Hi Friend, Try the following code: import java.util.*; class
ModuleNotFoundError: No module named 'flake8-unused-arguments'
ModuleNotFoundError: No module named 'flake8-unused-arguments'  Hi...: No module named 'flake8-unused-arguments' How to remove the ModuleNotFoundError: No module named 'flake8-unused-arguments' error? Thanks   
Command line arguments
Java application can accept any number of arguments directly from the command line. The user can enter command-line arguments when invoking the application. When running the java program from java command, the arguments are provided
List out different arguments in PHP header function?
List out different arguments in PHP header function?   List out different arguments in PHP header function
how many max. arguments we pass to the any function ? how many max. arguments we pass to the any function ?
how many max. arguments we pass to the any function ? how many max. arguments we pass to the any function ?   how many max. arguments we pass to the any function
function error too many input arguments
function error too many input arguments  function error too many input arguments
How to pass command line arguments in Java?
How to pass command line arguments in Java?  Hi, In a Java program I have to write for reading the command line arguments and use it in a programming. How to pass command line arguments in Java? Share me the sample code
Python parse arguments
Python parse arguments Example - Learn to parse command line arguments... command line arguments. The command line arguments are the data which is passed.... The arguments also work with the program running in production environment; here
us.fatehi - schemacrawler-commandline version 15.02.01 Maven dependency. How to use schemacrawler-commandline version 15.02.01 in pom.xml?
us.fatehi  - Version 15.02.01 of schemacrawler-commandline Maven...-commandline in pom.xml? How to use schemacrawler-commandline version 15.02.01... us.fatehi  - Version 15.02.01 of schemacrawler-commandline in project
us.fatehi - schemacrawler-commandline version 16.20.3 Maven dependency. How to use schemacrawler-commandline version 16.20.3 in pom.xml?
us.fatehi  - Version 16.20.3 of schemacrawler-commandline Maven...-commandline in pom.xml? How to use schemacrawler-commandline version 16.20.3 in pom.xml... us.fatehi  - Version 16.20.3 of schemacrawler-commandline in project
how many max. arguments we pass to the any function ?
how many max. arguments we pass to the any function ?   how many max. arguments we pass to the any function
Command Line Arguments in Java Program
Command Line Arguments in Java Program       Java application can accept any number of arguments directly from the command line. The user can enter command-line arguments when
Maven Repository/Dependency: us.fatehi | schemacrawler-commandline
Maven Repository/Dependency of Group ID us.fatehi and Artifact ID schemacrawler-commandline. Latest version of us.fatehi:schemacrawler-commandline dependencies. # Version Release Date
Maven Repository/Dependency: org.nuxeo.ecm.platform | nuxeo-platform-commandline-executor
Maven Repository/Dependency of Group ID org.nuxeo.ecm.platform and Artifact ID nuxeo-platform-commandline-executor. Latest version of org.nuxeo.ecm.platform:nuxeo-platform-commandline-executor dependencies
JavaScript Array Arguments
JavaScript Array Arguments     ... which enables the programmer to tell how many arguments (or variables) are passed... in the function. In the given example, we have passed the arguments in the following way
Java program to get the Command Line Arguments
Java program to get the Command Line Arguments... arguments as they are provided on the console. In this example program our program takes arguments from the console and print it on the console. In our example
please tell me about command line arguments in java?
please tell me about command line arguments in java?  please tell me about command line arguments in java?   Hi Friend, The command-line arguments are the arguments which are sent to the program being called. You can
please tell me about command line arguments in java?
please tell me about command line arguments in java?  please tell me about command line arguments in java?   Hi Friend, The command-line arguments are the arguments which are sent to the program being called. You can
Maven dependency for us.fatehi - schemacrawler-commandline version 16.16.7 is released. Learn to use schemacrawler-commandline version 16.16.7 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 09 Jan 2022, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.19.4 is released. Learn to use schemacrawler-commandline version 16.19.4 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 01 Dec 2022, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.19.1 is released. Learn to use schemacrawler-commandline version 16.19.1 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 21 Nov 2022, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.16.10 is released. Learn to use schemacrawler-commandline version 16.16.10 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 24 Jan 2022, the released version of  us.fatehi - schemacrawler-commandline
Maven dependency for us.fatehi - schemacrawler-commandline version 16.16.6 is released. Learn to use schemacrawler-commandline version 16.16.6 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 29 Dec 2021, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.17.3 is released. Learn to use schemacrawler-commandline version 16.17.3 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 06 Aug 2022, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.16.01 is released. Learn to use schemacrawler-commandline version 16.16.01 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 16 Nov 2021, the released version of  us.fatehi - schemacrawler-commandline
Maven dependency for us.fatehi - schemacrawler-commandline version 16.15.10 is released. Learn to use schemacrawler-commandline version 16.15.10 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 23 Oct 2021, the released version of  us.fatehi - schemacrawler-commandline
Maven dependency for us.fatehi - schemacrawler-commandline version 16.18.1 is released. Learn to use schemacrawler-commandline version 16.18.1 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 23 Aug 2022, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.15.6 is released. Learn to use schemacrawler-commandline version 16.15.6 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 13 Sep 2021, the released version of  us.fatehi - schemacrawler-commandline library
Maven dependency for us.fatehi - schemacrawler-commandline version 16.16.17 is released. Learn to use schemacrawler-commandline version 16.16.17 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 14 Jun 2022, the released version of  us.fatehi - schemacrawler-commandline
Maven dependency for us.fatehi - schemacrawler-commandline version 16.17.1 is released. Learn to use schemacrawler-commandline version 16.17.1 in Maven based Java projects
-commandline released The developers of   us.fatehi - schemacrawler-commandline project have released the latest version of this library on 23 Jul 2022, the released version of  us.fatehi - schemacrawler-commandline library

Ads