Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BadNews {
- public static void writeOdds() {
- // print each odd number
- int current = count;
- for (int count = 1; count <= ((max_odd/2)+ 1); count++) {
- System.out.print(current + " ");
- current = (2 * count) + 1;
- }
- }
- public static void main(String[] args) {
- int max_odd;
- // write all odds up to 21
- max_odd = 21;
- writeOdds(max_odd);
- // now, write all odds up to 11
- max_odd = 11;
- writeOdds(max_odd);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment