Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, 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.

Photo

Help With C#


  • Please log in to reply
1 reply to this topic

#1 Talonaces

Talonaces

  • Members
  • 51 posts
  • OFFLINE
  •  
  • Local time:05:21 PM

Posted 03 May 2008 - 11:14 AM

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.
Posted Image

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:03:21 PM

Posted 03 May 2008 - 05:03 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users