Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A) Show the output of the following code. ( IN JAVA) for ( int i = 2; i
A) Show the output of the following code. ( IN JAVA)
for ( int i = 2; i <= 7; i++) {
if (i % 2 == 0) System.out.println(i);
else System.out.println(i * i);
}
B.) Assume an int variable total (with an unknown value) and a char variable grade Write an if..else..if structure that assigns a value to grade based on the first condition that total meets as follows:
total less than 50,grade is 'D'
total less than 60, grade is 'C'
total less than 70,grade is 'B'
otherwise grade is 'A'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started