Answer:
class TriangleNumbers
{
public static void main (String[] args)
{
for (int number = 1; number <= 10; ++number) {
int sum = 1;
System.out.print("1");
for (int summed = 2; summed <= number; ++summed) {
sum += summed;
System.out.print(" + " + Integer.toString(summed));
}
System.out.print(" = " + Integer.toString(sum) + '\n');
}
}
}
Explanation:
We need to run the code for each of the 10 lines. Each time we sum numbers from 1 to n. We start with 1, then add numbers from 2 to n (and print the operation). At the end, we always print the equals sign, the sum and a newline character.
True the use many abstract power
Answer:
The match
Explanation:
You can light both the lantern and the candle if you light the match first.
I don't know of this is a homework question, but I answered it anyway :)
Answer:
your answer is correct
Explanation:
You have the correct mapping from inputs to outputs. The only thing your teacher may disagree with is the ordering of your inputs. They might be written more conventionally as ...
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
That is, your teacher may be looking for the pattern 1001 in the last column without paying attention to what you have written in column B.
It is High system pressure