Relational Operators

/*
* C# Programmers Pocket Consultant
* Author: Gregory S. MacBeth
* Email: gmacbeth@comporium.net
* Create Date: June 27, 2003
* Last Modified Date:
*/
using System;

namespace Client.Chapter_2___Common_Type_System
{
public class RelationalOperators
{
static void Main(string[] args)
{
int a, b;

a = 1;
b = 2;
if (a > b)
b = 10;

if (b < a) a = 10; if (a >= b)
b = 20;

if (b <= a) a = 20; if (a == b) b = 5; if (b != a) b = a; } } } [/csharp]

Numeric Operators 1

   
 
/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
 */
using System;

namespace Client.Chapter_2___Operators_and_Excpressions
{
  public class NumericOperators1
  {
    static void Main(string[] args)
    {
      int a, b, c, d, e;

      a = 1;
      a += 1;
      b = a;
      b -= 2;
      c = b;
      c *= 3;
      d = 4;
      d /= 2;
      e = 23;
      e %= 3;
    }
  }
}

           
         
     


Numeric Operators 3

   
 
/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
 */
using System;

namespace Client.Chapter_2___Operators_and_Excpressions
{
  public class NumericOperators2
  {
    static void Main(string[] args)
    {
      int   a,b,c,d,e,f;

      a = 1;      //1

      b = a + 1;    //2
      b = b - 1;    //1

      c = 1; d = 2;  
      ++c;      //2
      --d;      //1

      e = --c;    // e = 1 c = 1
      f = c--;    // f = 1 c = 0
    }
  }
}

           
         
     


Relational Operators 3

/*
* C# Programmers Pocket Consultant
* Author: Gregory S. MacBeth
* Email: gmacbeth@comporium.net
* Create Date: June 27, 2003
* Last Modified Date:
*/
using System;

namespace Client.Chapter_2___Operators_and_Excpressions
{
public class RelationalOperators2
{
static void Main(string[] args)
{
int a = 10, b = 20, c = 30;

if (a < 15 && b < 20) c = 10; if (a < 15 || b < 20) c = 15; if (!(a == 15)) c = 25; } } } [/csharp]