Answer:
Program in c++ and java
Explanation:
C++ Code
#include<iostream> //for input and output
#include <string> // for string
using namespace std;
int main()
{
string firstname;
string lastname;
cout<<"Please input your first name :";
cin>> firstname;
cout<<"Please input your last name :";
cin>> lastname;
cout<< "Your name is "<< firstname << " "<<lastname;
// declaring output string stream
return 0;
}
Java Code
import java.util.Scanner;
public class SquareRoot {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter your first name :");
String firstName = scanner.next();
System.out.print("Please enter your last name :");
String lastname = scanner.next();
System.out.println("Your name is "+firstName+" "+lastname);
}
}
Output
Please input your first name :John
Please input your last name :Stone
Your name is John Stone