Question #29504

write c++ program that selects and displays the first 20 integer numbers that are evenly divisible by 3.

Expert's answer

#include<iostream>

int main(){

int num = 0;
int i = 0;
while (num<20){
if (i%3==0){
std::cout<<i<<"\n";
num++;
}
i++;
}

getchar();
return 0;

}
LATEST TUTORIALS
APPROVED BY CLIENTS