Calculating variables

  • Thread starter Thread starter milton
  • Start date Start date
M

milton

Hi,

I'm new in C# programing, i would like to now how i can to calculate two
variables, how i can do this?

thanks
 
milton said:
Hi,

I'm new in C# programing, i would like to now how i can to calculate two
variables, how i can do this?

What do you mean by calculate two variables?

Do you mean perform mathematic calculations on them? If so, assuming they
are numeric variables(or ones that have the proper operators overloaded),
you simply do

result = variable1 + variable2; //add
result = variable1 - variable2; //subtract
result = variable1 / variable2; //divide
result = variable1 * variable2; //multiply

You can also use the Math class for most other basic mathematic fuctions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top