(Find numbers divisible by 3 or 6, but not both) Write a program that displays all the numbers from 300 to 400, 5 per line, that are divisible by 3 or 6, but not both. Numbers are separated by exactly one space.

PHOTO EMBED

Fri Oct 23 2020 07:14:14 GMT+0000 (UTC)

Saved by @mahmoud hussein #c++

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	
	int count = 0;
	
	// iterate from 0 to N 
	for (int num = 300,count = 0; num <=400; num++)
	{
		// Short-circuit operator is used  
		if (num % 3 == 0 || num % 6 == 0)
		{
			cout << setw(5) << num;
			count++;
			if (count % 5 == 0)
				cout << setw(5) << num << endl;
		
		}
		
		
			
	}
		

	
	
}
content_copyCOPY

http://cpp.sh/