<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Basic Math Error</title>
		<link>http://rbwhitaker.wikidot.com/forum/t-620087/basic-math-error</link>
		<description>Posts in the discussion thread &quot;Basic Math Error&quot; - error with an answer in math section</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 14 Jun 2026 00:10:57 +0000</lastBuildDate>
		
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-620087#post-1698133</guid>
				<title>(no title)</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-620087/basic-math-error#post-1698133</link>
				<description></description>
				<pubDate>Tue, 29 Jan 2013 20:20:54 +0000</pubDate>
				<wikidot:authorName>Sorthious</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Yeah&#8230;you nailed it&#8230;.I was taking each line as an individual example of a Compound Operator&#8230;haha</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-620087#post-1698076</guid>
				<title>(no title)</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-620087/basic-math-error#post-1698076</link>
				<description></description>
				<pubDate>Tue, 29 Jan 2013 19:16:43 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi Sorthious, thanks for the feedback! I'm glad you're finding it useful.</p> <p>Are you talking about near the end of <a href="http://rbwhitaker.wikidot.com/c-sharp-math">this tutorial</a>?</p> <p>If so, I think the numbers are actually correct, at least when you go through all of the code sequentially (as opposed to considering each line individually). That's what I was presuming to do, but perhaps I didn't make that clear enough in my tutorial.</p> <p>Here's that whole block again:</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">b</span><span class="hl-code"> = </span><span class="hl-number">7</span><span class="hl-code">; </span><span class="hl-identifier">b</span><span class="hl-code"> -= </span><span class="hl-number">3</span><span class="hl-code">; </span><span class="hl-comment">// This is the same as b = b - 3; At this point b would be 4.</span><span class="hl-code"> </span><span class="hl-identifier">b</span><span class="hl-code"> *= </span><span class="hl-number">5</span><span class="hl-code">; </span><span class="hl-comment">// This is the same as b = b * 5; At this point b would be 20.</span><span class="hl-code"> </span><span class="hl-identifier">b</span><span class="hl-code"> /= </span><span class="hl-number">4</span><span class="hl-code">; </span><span class="hl-comment">// This is the same as b = b / 4; At this point b would be 5.</span><span class="hl-code"> </span><span class="hl-identifier">b</span><span class="hl-code"> %= </span><span class="hl-number">2</span><span class="hl-code">; </span><span class="hl-comment">// This is the same as b = b % 2; At this point b would be 1.</span></pre></div> </div> <p>On the first line, <em>b</em> starts out being 7.</p> <p>On the second line, 3 is subtracted from <em>b</em>, resulting in a value of 4, and that is stored back into <em>b</em>. So at the end of running the second line, <em>b</em> contains a value of 4.</p> <p>On the third line (the one in question) <em>b</em> starts with a value of 4 and is multiplied by 5 to get 20. This is then put back into <em>b</em>. So after running line #3, <em>b</em> should contain a value of 20, as the comment suggests.</p> <p>And so on through the rest of the code.</p> <p>You're right, if we were just looking at the original starting value of 7, and then ran just the multiplication line (without the subtraction line in between) we'd have a value of 35 instead.</p> <p>The other thing is, after you pointed this block of code out to me, I saw that I was missing some semicolons. I've got those fixed now, thanks to you!</p> <p>Thanks again for bringing this up, and if you see anything else that looks like it might be out of place, don't hesitate to let me know!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-620087#post-1697978</guid>
				<title>(no title)</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-620087/basic-math-error#post-1697978</link>
				<description></description>
				<pubDate>Tue, 29 Jan 2013 17:08:04 +0000</pubDate>
				<wikidot:authorName>Sorthious</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Oh&#8230;and thank you, by the way, for this tutorial. It's put together really well and doesn't make the mistake most tutorials make by being too dry.</p> <p>Sorthious (^8</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-620087#post-1697973</guid>
				<title>Basic Math Error</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-620087/basic-math-error#post-1697973</link>
				<description></description>
				<pubDate>Tue, 29 Jan 2013 17:05:54 +0000</pubDate>
				<wikidot:authorName>Sorthious</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Under Compound Assignment Operators</p> <div class="code"> <pre><code>int b = 7; ... b *= 5 // This is the same as b = b * 5; At this point b would be 20. b should be 35</code></pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>