Java Program to print two numbers in two lines
Get two integer numbers, display them in two lines
Sample Input 1:
5 6
Sample Output 1:
5
6
Sample Input 2:
65 4
Sample Output 2:
65
4
Try your Solution
Strongly recommended to Solve it on your own, Don't directly go to the solution given below.
public class Hello
{
public static void main(String args[])
{
//Write your code here
}
}
Program or Solution
import java.util.*;
class Line
{
public static void main(String args[])
{
int Input1,Input2;
Scanner sc=new Scanner(System.in);
System.out.println("Enter The Two Inputs:");
Input1=sc.nextInt();
Input2=sc.nextInt();
System.out.println("The Outputs:"+Input1+"\n"+Input2);
}
}
Program Explanation
"\n" format specifier is used in println() function to move to new line.
Comments
Related Programs
- Java Program to Print Welcome
- Java Program to Print the given Message
- Java Program to Print the given word
- Java Program to print the given integer number
- Java Program to print the given fractional number
- Java Program to print the given fractional number in 2 digit decimal format
- Java Program to print the ASCII value of a character
- Java Program to print two numbers with a space between them
- Java Program to print two numbers with a tab space between them
- Java Program to Print the Character of given ASCII Value
- println Statement Example in Java
- Literals in Java With Example
- Print and println difference with Example
- Command Line Argument Example in Java
- Implicit Type Conversion Example in Java
- Explicit Type Conversion Example in Java
- Escape Sequences and Format Specifiers Example in java
coming Soon
coming Soon