/********************************************************************** * readme template * HW1: Conditionals and Loops **********************************************************************/ Name: PennKey: Recitation: Hours to complete assignment (optional): /********************************************************************** * Have you listedall help, collaboration, and outside resources * in your comments? If not, do so now. This includes listing help in * office hours. **********************************************************************/ /********************************************************************** * Problem A: What is the output of the following code? * * for (int i = 0; i < 5; i++) { * for (int j = 0; j < i; j++) { * System.out.print(i + j); * } * System.out.println(); * } * * You should work your answer out by hand first. Once you've * traced through the code manually, you can confirm it using DrJava. *********************************************************************/ /********************************************************************** * Problem B: Translate the following while loop into an equivalent * for loop, without changing the initial value of n. Once you have * done the conversion by hand, verify your answer using DrJava. * * int n = 50; * while (n > 0) { * n -= 2; * System.out.println(n); * } *********************************************************************/ /********************************************************************** * Describe any serious problems you encountered. **********************************************************************/ /********************************************************************** * If you completed the extra credit or added any additional features, * provide DETAILED and CLEAR instructions for how to use them and * what we should look for when grading your assignment. *********************************************************************/ /********************************************************************** * List any other comments here. **********************************************************************/