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.
 
Back
Top