Display some numbers

closed account (2yC2Nwbp)
I want to write a program that displays all the integers from 1 to 100 that are divisible by 6 or 7, but not both and I want to display 5 numbers per row. The output should be like the following

6 7 12 14 18
21 24 28 39 35
36 48 49 54 56
60 63 66 70 72
77 78 90 91 96
98

Please suggest the code logic that can give me the output logic. If possible please add the code snippet also.

Thank to all the readers.
Use the modulo operator.
http://www.cplusplus.com/doc/tutorial/operators/

1
2
if ( x % 6 == 0)
{  // x is divisible exactly by 6} 
Topic archived. No new replies allowed.