Computer Science, asked by chandan657012, 4 months ago

Question
Write a program to input age of 5 players
ayers and count number of teenagers. (age 13 - 19)​

Answers

Answered by kamalrajatjoshi94
0

Answer:

Program:-

import java.util.*;

public class Players

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

String name;

int age,tcount=0;

for(int a=1;a<=5;a++)

{

System.out.println("Enter the name of student");

name=in.nextLine();

System.out.println("Enter the age of student");

age=in.nextInt();

if(age>=13&&age<=19)

{

System.out.println("The boy is a teenager");

tcount++;

}

else

System.out.println("The boy is not a teenager");

}

System.out.println("Name="+name);

System.out.println("Age="+age);

System.out.println("Teenager count="+tcount);

}

}

Similar questions