Respuesta :
Answer:
if( age>=65)
{
seniorCitizens=seniorCitizens+1;
System.out.println("seniorCitizens counting is="+seniorCitizens);
}
else
{
nonSeniors=nonSeniors+1;
System.out.println("nonSeniors counting is="+nonSeniors);
}
Explanation :
In the above java program, if age will be more than or equal to 65 so seniorCitizens counting will be increased by 1 and if it will be less than 65 so 1 will be increased in nonSeniors.
The if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise is as follows;
seniorCitizens = 40
nonSeniors = 50
age = 65
if age >= 65:
seniorCitizens += 1
else:
nonSeniors += 1
print(seniorCitizens)
print(nonSeniors)
Code Explanation:
The code is written in python. Therefore,
- The variable seniorCitizens is initialise to 40
- The variable nonSeniors is initialise to 50
- The variable age is declared as 65
- The if statement check if the ag is greater or equals to 65. If it is equals or greater than 65, it will add 1 to seniorCitizens
- Else the 1 will be added to nonSeniors.
- Finally, we print our variables nonSeniors and seniorCitizens to see the values.
learn more on if/else statement here: https://brainly.com/question/13077847
