473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

What are the differences between the following if loops???

3
What is the difference between
-if(a%2==0&&a%3==0)
-if(!(a%2==0&&a%3==0) and
-if(!(a%2!=0&&a%3!=0)

Please explain
Mar 1 '14 #1
4 1159
Deva21
3
I forgot to ask this. Also give me the difference between if(!(a%2==0&&b%3==0)) and if(a%2!=0&&b%3!=0)
Mar 1 '14 #2
weaknessforcats
9,208 Expert Mod 8TB
Do you understand what a%2==0 means?

Let's start there.
Mar 1 '14 #3
Deva21
3
:( Yea,it is modulo division, and it gives the remainder when divided.. I checked the boolean values for all 3 and got their difference. Anyway Thank You.
Mar 1 '14 #4
donbock
2,426 Expert 2GB
The % operator is commonly called the "modulo" operator, however it can be argued that it is more mathematically accurate to call it the "remainder" argument. Regardless, I think @weaknessforcats was asking you what it means when a%2 is equal to 0. What does that tell you about a and 2?

By the way, when considering a%b, it is helpful if you are certain that both a and b are greater than 0. The results are counter-intuitive for negative operands; Zero is not allowed for b; and 0 % b is 0 for all nonzero b. the modulo and remainder arguments give the same results for positive operands, but results differ for negative operands. - but this is a pedantic distinction of no relevance to your original question.
Mar 2 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: BB | last post by:
For send mail from a web page is there any benefit in using CDOSYS over CDONTS? Are the methods the same? How do you Set the object? Thanks BB
5
by: Rick | last post by:
Hello, I posted a question regarding data validation earlier and it worked great! I have a new question. Is there anyway to cut through all the if statements and just have a for loop that uses...
4
by: Rick Ng Chi Wah | last post by:
Dear all, I am a beginner of C language. I want to know following C terminologies: preprocessor complier object code linker executable file
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
0
by: amit129 | last post by:
hi, Please tell me what the below mentined code is doing? If i pass String s as my name is "xyz. and " i am writing . what should be the output. Thanks in advance void parse(Block<String>&...
1
by: just curious | last post by:
anything you can tell me about loops thanks
3
by: dav2fun | last post by:
:7,11s/\^\/Toughie/c
2
by: sara ali alali | last post by:
foreach (char c in textBox1.Text) bits += Convert.ToString((int)c,2).PadLeft(8, '0');
1
by: sara ali alali | last post by:
Dim tags As HtmlElementCollection = WebBrowser1.Document.All
3
by: Himanshu Saxena | last post by:
Hi, I have a javascript with the following code: caburl="http://"+top.window.location.host+"/ims.cab"; cabver="1,1,1,5"; document.write("<object id='IMS' width=0 height=0...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.