modulus operator %

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2006
Posts: 131
Reputation: degamer106 is an unknown quantity at this point 
Solved Threads: 0
degamer106 degamer106 is offline Offline
Junior Poster

modulus operator %

 
0
  #1
Apr 13th, 2006
Hmm I was lookin through a recursion program in this book i have here and the only thing I'm having trouble with is the modulus operator.

I know that it returns the remainder of 2 numbers.

But, suppose I have this: x % y

If x > y then the result is x. Am I tripping out o_O?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: modulus operator %

 
1
  #2
Apr 13th, 2006
Originally Posted by degamer106
If x > y then the result is x. Am I tripping out o_O?
if x is 6 and y is 2, then the result is 0.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 131
Reputation: degamer106 is an unknown quantity at this point 
Solved Threads: 0
degamer106 degamer106 is offline Offline
Junior Poster

Re: modulus operator %

 
0
  #3
Apr 13th, 2006
i'm sorry i meant if x < y.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: modulus operator %

 
0
  #4
Apr 13th, 2006
Originally Posted by degamer106
i'm sorry i meant if x < y.
Yes, then result will be x.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC