227k views
5 votes
Give the value of following Java expressions.

false || 6 > 12 && !(3==7)

1 Answer

11 votes

Answer:

public class Program

{

public static void main(String[] args)

{

int j=18;

int sum=0;

for (int i =1; i<7; i++)

{

sum=sum+(i*(j-2));

j=j-2;

}

System.out.println(sum);

}

}

Step-by-step explanation:

Variables used:

j : controls the first number in product and decreases by 2 each time the loop runs.

sum: saves the values of addition as the loop runs.

User Phil Parsons
by
3.9k points