Ask Question

Write an 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. Assume all variables have been declared.

Answers (1)
  1. 11 October, 16:00
    if (age>=65)



    System. out. println ("seniorCitizens counting is="+seniorCitizens);





    System. out. println ("nonSeniors counting is="+nonSeniors);



    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.
Know the Answer?
New Questions in Computers & Technology