while
Code | Execution |
---|---|
|
Enter repetitions: 3 Do not copy! Do not copy! Do not copy! |
int threeSeries = 1;
while ((threeSeries *=3 ) < 100);
System.out.println(threeSeries);
Exercise: Guess resulting output.
No. 62
Generating square numbers
Q: |
Write an application printing the first ten square numbers. The output should look like: The square of 1 is 1 The square of 2 is 4 The square of 3 is 9 The square of 4 is 16 The square of 5 is 25 The square of 6 is 36 The square of 7 is 49 The square of 8 is 64 The square of 9 is 81 The square of 10 is 100 |
A: |
|
No. 63
Calculating factorial
Q: |
The factorial of a given integer n is being defined as the following product: In addition the factorial of zero is being defined as: Write an application asking a user for an integer value and calculate the corresponding factorial e.g.: Enter an integer value: 5 5! == 120 |
A: |
|