Skip to content

Commit dc39116

Browse files
committed
feat: Add age-based check to determine if a person is young
🧠 Logic: - Prompts user to enter the person's age. - Checks if age lies within the range 14 to 55 (inclusive). - If true, prints "Person is young". - Else, prints "Person is not a young". Signed-off-by: Somesh diwan <[email protected]>
1 parent 28a3a1b commit dc39116

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
/*Find a person is young or not young
2-
if(age >= 14 && age <= 55)
3-
if age>=14 true young.
4-
if(age <14 || age > 55) not young.*/
1+
/*
2+
Find a person is young or not young.
3+
4+
if(age >= 14 && age <= 55), if age>=14 true young, if(age <14 || age > 55) not young.
5+
*/
56

67
import java.util.Scanner;
78

@@ -13,12 +14,10 @@ public static void main(String[] args) {
1314

1415
age = scanner.nextInt();
1516

16-
if(age >=14 && age <=55)
17-
{
17+
if(age >=14 && age <=55) {
1818
System.out.println("Person is young");
19-
}
20-
else {
19+
} else {
2120
System.out.println("Person is not a young");
2221
}
2322
}
24-
}
23+
}

0 commit comments

Comments
 (0)