forums Computer Tutorials Computer Help and Spyware Removal File DatabaseUninstall Database Windows Startup Programs Database Computer Resources Computer Glossary Forums Computer Help and Spyware Removal
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

 
Reply to this topicStart new topic
> Help With C#, Computing absolute value
Talonaces
post May 3 2008, 11:14 AM
Post #1


Member
**

Group: Members
Posts: 45
Joined: 23-December 04
Member No.: 7,734



Anyone,

I was given the following questions:

Given a variable with unknown value int abs, write a probgram that will print out the absolute value of abs. Hint: negate a variable by multiplying it by -1.

Ok. Thats it. I am very new to C# and programming overall. Having difficulty understanding the code and how it works. Can someone show me the code for this, and explain what it is doing? I have tried tutoring, online tutorails, and other stuff, but for some reason, I am just not getting it. Any help would be appreciated.


--------------------
user posted image
Go to the top of the page
 
+Quote Post
groovicus
post May 3 2008, 05:03 PM
Post #2


Hail Groovicus!
******

Group: Site Admin
Posts: 5,698
Joined: 5-June 04
From: Vermillion, SD
Member No.: 689



We would be glad to help you once you have shown us your code, but the general flow of the problem is as follows:

If the value of abs is less than zero, multiply by -1, else it is already the absolute value.
Print out the value of abs.

Do you know how to check the value of a variable?
Do you know how to multiply a variable?
Do you know how to print to the console?


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 19th July 2008 - 08:34 PM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Malware Removal Guides

© 2003-2008 All Rights Reserved Bleeping Computer LLC.