Help - Search - Members - Calendar
Full Version: Help With C#
BleepingComputer.com > Software > Programming
   
Talonaces
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.
groovicus
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?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.