|
| assaado (7) | |||
| Greetings everyone, I'm a novice to C++, just started working with it a couple of days ago. I wrote a program that computes the sum of all integers between 1 and 100 that have a remainder of 2 when divided by 3, 5 or by both. Here is the code:
Is there a way to enhance this code? Another question; I have been trying to write a program that prints all the three digit integers that use three distinct digits from a set, ie {1, 2, 3, 4, 5, 6, 7}. It should print 123, 324, 567, 712 but not 773 or 333. Thanks in advance | |||
Last edited on | |||
| hamsterman (362) | |||
| There are no and/or keywords in c++. see http://www.cplusplus.com/doc/tutorial/operators/ logical operators. Also, "div1==2 or div2==2" already covers the case when div1 ==2 and div2==2. edit: about the other problem.
| |||
Last edited on | |||
| assaado (7) | |
| Thank you. I'm using the Code::Blocks 8.02 compiler and it accepts and and or keywords; I replaced them with && and || though. Thanks again for your help | |
| Bazzy (4111) | ||
| ||
This topic is archived - New replies not allowed.
