- What is wrong with the following code fragment?
if (total == max)
if (total < sum)
System.out.println("total == max and is < sum.");
else System.out.println("total is not equal to max");
- What is wrong with the following code fragment?
if (length = min_length)
System.out.println("The length is minimal.");
- What is printed by the following code fragment?
int num = 87, max = 25;
if (num >= max*2)
System.out.println("apple");
System.out.println("orange");
System.out.println("pear");
- What is printed by the following code fragment?
int limit = 100, num1 = 15, num2 = 40;
if (limit <= limit)
{
if (num1 == num2)
System.out.println("lemon");
System.out.println("lime");
}
System.out.println("grape");
- P9: write a java program that prompts for two integers and prints the
larger [solution]
- P10: write a java program that prompts for three real numbers and prints
how many of them are greater than zero [solution]