Welcome Guest ( Log In | Click here to Register a free account now! )
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.![]() ![]() |
May 3 2008, 11:14 AM
Post
#1
|
|
|
Member ![]() ![]() Group: Members Posts: 45 Joined: 23-December 04 Member No.: 7,734 |
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. -------------------- ![]() |
|
|
|
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? -------------------- |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 19th July 2008 - 08:34 PM |