Write a program to enter 3 numbers. Concatenate the numbers. Print the concatenated
number.
Sample Input: 3 numbers are 23, 567, 84 Concatenated number is: 2356784
Use Java
Answers
Answered by
2
Answer:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String str;
Scanner read=new Scanner(System.in);
System.out.print("Enter number 1:");
String no1=read.nextLine();
System.out.print("Enter number 2: ");
String no2=read.nextLine();
System.out.print("Enter number 3: ");
String no3=read.nextLine();
str=String.format("The concatenated string is %s",no1+no2+no3);
System.out.println(str);
}
}
Similar questions