
For example:
int number1, number2, sum;
number1 = 10;
number2 = 20;
sum = number1 + number2;
In the last statement, two variables using the + symbol. The + is a operator also there are many operators in c#.
Some mathematical operators used for mathematical calculations in programming:
Operator | Usage |
+ | Addition |
- | Subtraction |
/ | Division |
% | Percentage |
* | Multiplication |
Some decision making statements:
Operators | Usage | Example |
== | Equal | if(x==y) |
&& | Checks for multiple conditions | if(x>y)&&(y>z) |
> | Greater than | if(x>y) |
< | Less than | if(x<y) |
|| | Checks for multiple conditions | if(x<y)||(y<x) |
>= | Greater than or equal | if(x=>y) |
<= | Less than or equal | if(x<=y) |
!= | Not equal to | x != y |
:)
1 comments:
csharp codes has c# codes too much
ReplyPost a Comment
Note: Only a member of this blog may post a comment.