Answer to Question #291307 in C++ for ali

Question #291307

 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


1
Expert's answer
2022-01-29T02:43:46-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog