Answer:
I will write the code in C++ and JAVA
Explanation:
<h2>
C++ Program:</h2>
#include <iostream>
using namespace std;
int main()
{ std::string NAME;
// i have used std::string so that the input name can be more than a single character.
std::cout << " enter the name"; // take an input name from user
std::getline(std::cin,NAME);
int AGE;
cout<<"Enter age"; //takes age from the user as input
cin>>AGE;
cout<<"The age of "; std::cout <<NAME; cout<< " is " << AGE; }
/* displays the message for example the name is George and age is 54 so message displayed will be The age of George is 54 and this will be displayed without a period */
<h2>
Explanation:</h2>
The program first prompts the user to enter a name and the asks to input the age of that person. As per the requirement the if the user enter the name George and age 54, the program displays the following line as output:
The age of George is 54
Here std::string is used so that the input string can be more than one character long.
<h2>
JAVA code</h2>
import java.util.*;
public class Main
{ public static void main(String[] args) {
String NAME;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a name:");
NAME= sc.nextLine();
int AGE;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter age:");
AGE = Integer.parseInt(scanner.nextLine());
System.out.print("The age of " + NAME + " is " + AGE); }}
<h2>
Explanation:</h2>
This is the JAVA code which will work the same as C++ code. The scanner class is used to read the input from the user. The output of the above JAVA code is as follows:
Enter a name: George
Enter age: 45
The age of George is 45