UoW SG Corner

Welcome to UoW SG Corner, a forum for all of us!!! We can have a chit chat here, share anything we have! Make your university life more interesting with this forum! Enjoy it!!!
HomeHome  ­CalendarCalendar  ­FAQFAQ  ­SearchSearch  ­MemberlistMemberlist  ­UsergroupsUsergroups  ­RegisterRegister  ­Log inLog in  
Post new topic   Reply to topicShare | 
 

 Hi... Some qns i wanna ask..

View previous topic View next topic Go down 
AuthorMessage
xiaoming



Number of posts: 5
Age: 23
Registration date: 2008-10-07

PostSubject: Hi... Some qns i wanna ask..   October 8th 2008, 22:32

Hi pple... I was reading the notes on Topic 3 and i came across tis slide where i'm baffled by the ans stated on it. Its slide 36 of Topic 3. The 2nd eg. stated tat
" 3 / 2 + 2.5 = 3.5". Shouldn't the ans be 4? Similarly on slide 37, the 1st eg. stated tat " 2 + 3 / 2 = 3" and the 8th eg. stated tat " 15.0 - 5 / 2 = 13". Shouldn't the ans be 3.5 and 12.5 respectively? On the contrary, for eg. 3 & 6 of slide 37, the ans are correct. I noticed tat sometimes when an odd number divides by 2, the result will hv a .5 and sometimes, there isn't a .5 . So when is it that i need to include the .5 and when don't i need to include it? Btw, how do we use a % (modulus)? The last eg. on slide 37 states tat " 1 + 2 % 3 + 1 = 4.0". Haha.. I dun understand it.

Can someone ans my qns? THANKS Laughing

Sorry for troubling u pple jus becos i wasn't paying attention in class... Embarassed
Back to top Go down
View user profile
donysukardi
Admin


Number of posts: 54
Age: 19
Location: Holland Drive
Registration date: 2008-10-05

PostSubject: Re: Hi... Some qns i wanna ask..   October 8th 2008, 23:04

For modulus you can refer to http://en.wikipedia.org/wiki/Modulo_operation and http://www.cprogramming.com/tutorial/modulus.html
Back to top Go down
View user profile http://uowsgcorner.forumotion.net
xiaoming



Number of posts: 5
Age: 23
Registration date: 2008-10-07

PostSubject: Re: Hi... Some qns i wanna ask..   October 8th 2008, 23:09

Mm.. ok i analysed it abit. Theres a rule stated on slide 36 * Result of an operation involving an integer and a floating- point number is = a floating- point number.* Meaning for Slide 36 eg.2, "3 / 2 + 2.5 = 3.5" is equals "1 + 2.5 = 3.5" theres no floating pt number therefore 3 / 2 is = 1 ( .5 is omited) as for eg. 6 of slide 37, " 0.5 + 3.0 / 2" is equals " 0.5 + 1.5 = 2" , becos the 3.0 is a floating-pt number, therefore for the ans there is a .5 .

And for the last eg. of slide 37, "2 % 3 = 2 ( remainder is 2) therefore, 1 + 2 + 1 = 4.0".

Am i correct to say tat?

If I'm correct, then I solved my own qns.

Thanks for reading my post anyway...
Back to top Go down
View user profile
donysukardi
Admin


Number of posts: 54
Age: 19
Location: Holland Drive
Registration date: 2008-10-05

PostSubject: Re: Hi... Some qns i wanna ask..   October 8th 2008, 23:58

yeah.. i've just figured it out. Yeap.. the result of an operation involving two integers is an integer. Very Happy

yeap.. they are all correct!!! congratz.. lol!

you're welcome.. and thanks for posting.. Very Happy
Back to top Go down
View user profile http://uowsgcorner.forumotion.net
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: Hi... Some qns i wanna ask..   October 9th 2008, 00:56

well, thanks for sharing, now we know when we want to result to be more accurate, instead of set the number become Int, should set it as Float, so that we can include .5 or other including point number.
Back to top Go down
View user profile http://clansgaf.motionsforum.com
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: Hi... Some qns i wanna ask..   October 9th 2008, 14:23

just heard the lecture, i notice that the last eg, last term is "1." so it's actually "1.0", hence the answer become 4.0 instead of 4.
Back to top Go down
View user profile http://clansgaf.motionsforum.com
 

Hi... Some qns i wanna ask..

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
UoW SG Corner :: Classes :: CSCI114-
Post new topic   Reply to topic