129k views
2 votes
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.

User Kodvin
by
7.7k points

1 Answer

1 vote
int i = 1;
for(i = 1; i <= 200; I++) {
if((i % 2) == 0 && (i % 3) == 0) {
printf("%i ", i);
}
}
User David Fletcher
by
8.5k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.