write a program to accept user name and its age and print "Hello ram you are 14 years old in java.
Answers
Answered by
6
Here is your code:
import java.util.Scanner;
public class Brainly_Java
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = sc.next(); //Taking Name Input
System.out.print("Enter your age: ");
int age = sc.nextInt(); //Taking Age Input
System.out.println("\nHello "+name+". You are "+age+" years old.");
}
}
Hope it helps
Purva
Brainly Community
import java.util.Scanner;
public class Brainly_Java
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = sc.next(); //Taking Name Input
System.out.print("Enter your age: ");
int age = sc.nextInt(); //Taking Age Input
System.out.println("\nHello "+name+". You are "+age+" years old.");
}
}
Hope it helps
Purva
Brainly Community
QGP:
You are welcome :)
Similar questions