To subtract two numbers in C# you can use the "-" operator. Here's an example:
main.cs97 chars7 lines
In the above code, we declare two integer variables num1
and num2
with values of 10 and 5 respectively. Then, we subtract num2
from num1
using the "-" operator and store the result in result
. Finally, we print the result to the console.
gistlibby LogSnag