i am a novice programmer and i want to learn through practicing.
#include <iostream>
using namespace std;
int main()
{
for(int i=0;i<=6;i++)
{
if((i<=3)&&(i==5))
continue;
cout << i << "\t";
}
}
I created the above code and my required output of this code is 4 6. when i compile and run this code the output is 0 1 2 3 4 5 6 which is not my required output. I can get my required output through || operator.
#include <iostream>
using namespace std;
int main()
{
for(int i=0;i<=6;i++)
{
if((i<=3)||(i==5))
continue;
cout << i << "\t";
}
}
In the above code the output is 4 6 which is my required output. why i can't get my required output through this conditional statement if((i<=3)&&(i==5)) ?
you may want to review boolean algebra concepts.
de Morgan’s Theorem ... if you can understand this, you will see why, look for a light-math simple english explain of it (because it seems unlikely you will be able to read boolean algebra notation heavy proofs etc at this time, or circuitry examples which are also notation heavy).
What is an equivalent statement to "The lawn needs mowed and the car needs washed, but I will not do both."?
The two propositions are "I will mow the lawn" and "I will wash the car." Simply change the statement to an "or" statement and negate each of these propositions:
"Either I will not mow the lawn or I will not wash the car."
Note that this statement leaves open the possibility that one of the chores is completed, and it is also possible that neither chores are completed.