// First Last
// email@address.com
//
// Date
// Comment on what this class does
public class FirstnameLastnameLab {
public static void main(String[] args) {
convertToForLoop ();
printOneToTen();
printEvenNumbersFromTwoToTwenty();
printSumOfOneToTen ();
}
static void convertToForLoop() {
// Comment out the below lines and replace
// with a for loop
int i = 0;
i = i + 3;
i = i + 3;
i = i + 3;
i = i + 3;
System.out.println (i);
}
static void printOneToTen () {
// write a for loop that prints the numbers
// one to ten. Print each number on a new
// line
for (int i = 1; i <= 10; i++) {
// fill in
}
}
static void printEvenNumbersFromTwoToTwenty () {
// write a for loop that prints even
// numbers from 2 to 20
// write for loop here
}
static void printSumOfOneToTen () {
// write a for loop that prints the sum of
// 1 to 10 (1 + 2 + 3 + 4 ... + 10)
int sum = 0;
// write for loop here
System.out.println (sum);
}
}
No comments:
Post a Comment