InputFromKeyBoard
This commit is contained in:
22
InputFromKeyBoard.java
Normal file
22
InputFromKeyBoard.java
Normal file
@@ -0,0 +1,22 @@
|
||||
// Program to demonstrate input from keyboard using Command line argument.
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
|
||||
public class InputFromKeyBoard {
|
||||
public static void main(String [] args) {
|
||||
int n;
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.print("Enter the number of names you want to store: ");
|
||||
n=sc.nextInt();
|
||||
String[] array = new String[n];
|
||||
System.out.println("Enter the names: ");
|
||||
for(int i=0; i<n; i++) {
|
||||
array[i]=sc.next();
|
||||
}
|
||||
System.out.println("The names are: ");
|
||||
for (String s : array) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,8 @@ if the problem still persist then create a issue or use Google/Stack Overlflow f
|
||||
|12 | [RootsOfQuadracticEquationStatic.java](https://github.com/psavarmattas/Java-Projects/blob/master/RootsOfQuadraticEquationStatic.java) | Program to find the root of quadratic equation (Static Method). |
|
||||
|13 | [RootsOfQuadracticEquation.java](https://github.com/psavarmattas/Java-Projects/blob/master/RootsOfQuadraticEquation.java) | Program to find the root of quadratic equation (Dynamic Method). |
|
||||
|14 | [Calculator](https://github.com/psavarmattas/Java-Projects/blob/master/Calculator.java) | Program that implements the arithmetic operation (Calculator) using switch statement.
|
||||
|15 | [ArithmeticOperations.java](https://github.com/psavarmattas/Java-Projects/blob/master/ArithmeticOperations.java) | Program to print the sum (addition), multiply, subtract, divide and remainder of two numbers |
|
||||
|15 | [ArithmeticOperations.java](https://github.com/psavarmattas/Java-Projects/blob/master/ArithmeticOperations.java) | Program to print the sum (addition), multiply, subtract, divide and remainder of two numbers. |
|
||||
|16 | [InputFromKeyBoard.java](https://github.com/psavarmattas/Java-Projects/blob/master/InputFromKeyBoard.java) | Program to demonstrate input from keyboard using Command line argument. |
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +49,7 @@ if the problem still persist then create a issue or use Google/Stack Overlflow f
|
||||
|----------|------------|--------------------------|
|
||||
|1 | [HelloWorld.java](https://github.com/psavarmattas/Java-Projects/blob/master/HelloWorld.java) | Program to print out "Hello World" |
|
||||
|1 | [EvenOdd.java](https://github.com/psavarmattas/Java-Projects/blob/master/EvenOdd.java) | Program to find out the number entered is Even/Odd (Static Method). |
|
||||
|1 | [InputFromKeyBoard.java](https://github.com/psavarmattas/Java-Projects/blob/master/InputFromKeyBoard.java) | Program to demonstrate input from keyboard using Command line argument. |
|
||||
|1 | [LargestNumberStatic.java](https://github.com/psavarmattas/Java-Projects/blob/master/LargestNumberStatic.java) | Program to find out the largest number (Static Method). |
|
||||
|1 | [PrimeOrNotStatic.java](https://github.com/psavarmattas/Java-Projects/blob/master/PrimeNoStatic.java) | Program to find out the prime or not (Static Method). |
|
||||
|1 | [PrimeNoStatic.java](https://github.com/psavarmattas/Java-Projects/blob/master/PrimeNoStatic.java) | Program to display first n Prime number (Static Method). |
|
||||
|
||||
Reference in New Issue
Block a user