Write a for loop that prints, in ascending order, all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces.

LANGUAGE: C++

CHALLENGE:

Write a for loop that prints, in ascending order, all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces.

SOLUTION:

The Bad News: The content you are trying to access is only available to members.

The Good News: You too can be a member, simply Click Here.

Already a member?

Posted in ,

2 Comments

  1. Malcolm A. Morgan on February 19, 2016 at 6:22 am

    THIS IS THE CODE FOR C:

    int i;

    for (i=1; i<200; i++){
    if ((i%2)==0 && (i%3)==0){
    printf(" %d", i);
    }
    }

  2. Jacob Bourne on February 9, 2017 at 4:51 pm

    JAVA:

    for (int i = 1; i < 200; i++) {
    if ((i%2)==0 && (i%3)==0) {
    System.out.print(i + " ");
    }
    }

Leave a Comment

You must be logged in to post a comment.