Create a program that loops 30 times, but only outputs numbers that are not divisible by 3 or 5. Decide on the most appropriate form of a loop, and use an if statement inside it
#include <iostream>
using namespace std;
int main(){
for(int i=0;i<=30;i++){
if(i%3!=0 && i%5!=0){
cout<<i<<"\n";
}
}
system("pause");
return 0;
}
Comments
Leave a comment