Read and Echo an Age
Easyjava
Learn the Concept: User InputRead one integer from input and echo it back in a sentence.
Input: one integer — an age.
Output: one line: Your age is: <age>
Example 1
Input
22
Output
Your age is: 22
- 0 <= age <= 150
Hint 1
sc.nextInt() reads the number.
Hint 2
Concatenate: "Your age is: " + age.
Read the integer with nextInt() and print it inside the required sentence. (On this judge you never print an "Enter your age" prompt — the input arrives directly.)
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Sum of N NumbersEasy · javaSolve Problem
- Read Three Different TypesEasy · javaSolve Problem
- Name Then AgeMedium · javaSolve Problem