Fifth class Material (Operators in details)
1. Arithmatic operator : +, - , * , / , %
2. Arithmatic assignment operator : +=, -= , *= , /= , %=
3. Unary Operator : ++, --
4. Comparison Operator : < , > , <=, >=, ==, !=
5. Logical Operator : &&, ||, !
1. Arithmatic operator :
we have seen this operator...
2. Arithmatic assignment operator :
Example 1
using System;
class com
{
public static void Main()
{
int a=4, b=3;
a=+b;
Console.WriteLine("a is : "+a+" and "+"b is : "+b);
}
}
output is : a is 3 and b is 3
Example 2
using System;
class com
{
public static void Main()
{
int a=4, b=3;
a+=b;
Console.WriteLine("a is : "+a+" and "+"b is : "+b);
}
}
output is : a is 7 and b is 3
Example 3
using System;
class com
{
public static void Main()
{
int a=4, b=3;
a+=b;
b+=a;
Console.WriteLine("a is : "+a+" and "+"b is : "+b);
}
}
No comments:
Post a Comment