Jan Return 1
State: at the start of class, people do not remember how to write a “for” loop and could barely write an “if” statement.
-
Print all of the numbers 1 to 100.
-
Except print
*
instead of multiples of 13. -
Count from 50 down to 10.
-
Print
*
on multiples of 7. -
Oops, you should also print
*
for multiples of 5. -
How many digits in an integer?
public static int countDigits (int n) { // ... think of more than one way ... }
-
Given the String below, how do you get the letters “eLsi”?
String p = "SamueLsiLV";
-
Count how many times the letter “s” appears in a string. Try writing two different kinds of solution.
public static int countS(String x) { ... }
-
Given a string, how many times does it contain “bat” either forward or backward?
public static int countBat(String x) { ... }
-
Do the first row of CodingBat String-2.