htdefiant
Dec 14 2007, 11:11 PM
| | What does the % symbol do? For example, if num1 has the value of 120 and num2 has the value 2, what will num1%num2 generate? Thanks |
Reply
bhavesh
Dec 15 2007, 08:54 AM
It is called the mod operator and gives remainder. That is num1%num2 will divide num1 from num2 and will display the remainder. In your example it will return 0, as 120 is completely divisible by 2.
Reply
htdefiant
Dec 15 2007, 03:28 PM
So, if num2 was 24, it would give me 5 with a remainder of 0?
Reply
truefusion
Dec 15 2007, 04:16 PM
QUOTE(htdefiant @ Dec 15 2007, 10:28 AM)  So, if num2 was 24, it would give me 5 with a remainder of 0? It wouldn't, or i should say, shouldn't give you the 5. It's purpose is to return the remainder—nothing else. You see this in PHP, too, since PHP is based on C, as well as other programming languages.
Reply
htdefiant
Dec 15 2007, 04:36 PM
Ah, ok. Thank you very much for your help.
Reply
bhavesh
Dec 15 2007, 04:48 PM
I think you are not getting it. Try this program in C CODE main() { int num1,num2; printf("Enter num1 : "); scanf("%d",&num1); printf("Enter num2 : "); scanf("%d",&num2); printf("num1%num2 is %d", num1%num2); }
Reply
htdefiant
Dec 15 2007, 04:55 PM
That program crashes my DOS window for some reason. But I think I understand - if I put in 120 and 24, the output would be 0? Thanks for your patience
Reply
rvalkass
Dec 15 2007, 04:59 PM
Yes, as 120 divided by 24 is exactly 5. If you used 50 and 7 then the output would be 1. If you used 99 and 4 then the output would be 3.
Reply
htdefiant
Dec 15 2007, 05:01 PM
Alright, thank you.
Reply
Csshih
Dec 17 2007, 05:14 PM
You can also try those numbers on google, but I'm not sure it will return the same results as it would in a program. Just enter what you want to calculate onto the search bar and press search. Google has its built in calculator.
Reply
Similar Topics
Keywords : purpose, percentage, symbol, c,
- Addicted To Blogging?
Know your blog addiction percentage here. (0)
Easter Eggs Is Symbol For Jesus' Resurrection As Well As Fish Image.
Why Eggs in Easter (9) 1. Christian use the egg as Symbol of Jesus Resurrection, Some dead was resin by Jesus but Jesus
was risen by itself as the chicken brooks the egg to get out by itself. 2. Also Christian are using
fish as symbol for Resurrection because of the story of Jonah in the Whale. As Jonah was inside the
whale 3 days , Jesus was in the tomb 3 days. Even Jesus said about that : QUOTE Matthew 12:39 -
But he answered them, "An evil and adulterous generation seeks for a sign; but no sign shall be
given to it except the sign of the prophet Jonah Matthew 12:40 - For as Jonah w....
Username Warning Percentage Question
(2) i have a warning percentage of 10...how do you get these warnings? how can i find out how i have
earned a warning? how do get rid of my warnings? what happens when your warning has reached the
highest??....
My Purpose On This Forum
Spread my ideas about... (10) I'm your typical teenage computer nerd (OK, maybe not sooooo typical /tongue.gif"
style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> ). I run a web site, I post
here, I read tech news. So here's what I am trying to accomplich on Trap17: -Spread my belief
in hybrid buses (especially the Orion VII hybrid, which we use here in NYC) -Get my wonderful free
hosting -Make a few friends (which I desperately need) -Get away from the rest of my life (ex.
school, family, etc.) -Occupy unused time -Find free stuff -Learn more in general about computer....
The Trap17 All-purpose Help Desk
Just an Idea... (4) I love what Trap17 is doing here. I love being apat of communities like this, and here you got
hosting for it! What more could you ask for! Well ive got an idea: The all purpose help
desk. We have so many users here, all of us together probably have knoweledge about pretty much
every thing. So why not open a "Help Desk"? At the "Help Desk" Users could submit a question about
any thing (Probably via email) then us here could sort of "Claim" the message if we know the answer.
All the question could be posted in a forum here, then once a user "Claims it" the topi....
Symbol Burning
photoshop (6) Oke this is my first tutorial, so be gentle /wink.gif' border='0' style='vertical-align:middle'
alt='wink.gif' /> . The first part of my tutorial is based on an other tutorial:
http://ele-st.org/forums/index.php?showtopic=865 This is the first part from that website.
QUOTE Start out by making a new document, at least 300x300, and size bigger than that is ok as
well. Fill your background with black, and get out your brush tool. Use a soft round 17 px brush.
Now to start the brushing. We'll be making a tree like figure, with multiple branches. Start
from th....
The Best Tv Advert Ever?
Serves no useful purpose at all! (4) Here's a little song for anyone who's ever hated - in the key of "Grrr".
http://multimedia.honda-eu.com/diesel/Movie.swf Thats a great advert due to its annoying factor.
Honda have a clever marketing team. Like the famous "Cog" advert... I don't study adverts in
any great detail, but you have to admit there are some good ones! Any others you've found
great? "Hate something, change something, make something better..."....
Purpose Of Cgi-bin?
(5) I'm not sure if i'm posting in the right (sub)forum but it certainly has something to do
with it /cool.gif' border='0' style='vertical-align:middle' alt='cool.gif' /> . Now, i wonder
what's the meaning of "cgi-bin". When connecting to ftp you find a folder with this name. Can
anyone tell me what its function is? I also found this folders /blink.gif' border='0'
style='vertical-align:middle' alt='blink.gif' /> : - _vti_bin - _vti_cnf - _vti_log - _vti_pvt
- _vti_txt Thanks in advance! /biggrin.gif' border='0' style='vertical-align:middle' a....
Looking for purpose, percentage, symbol, c,
|
|
Searching Video's for purpose, percentage, symbol, c,
|
advertisement
|
|