If else for int : If « Language Basics « C# / C Sharp






If else for int

If else for int
/*
 * 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_4___Program_Control
{
  public class ifelse
  {
    static void Main(string[] args)
    {
      int a = 5, b = 5, c = 10;

      if (a == b)
        Console.WriteLine(a);

      if ((a > c) || (a == b))
        Console.WriteLine(b);

      if ((a >= c) && (b <= c))
        Console.WriteLine(c);
    }
  }
}

           
       








Related examples in the same category

1.Determine if a value is positive or negativeDetermine if a value is positive or negative
2.Determine if a value is positive, negative, or zeroDetermine if a value is positive, negative, or zero
3.Demonstrate the ifDemonstrate the if
4.Demonstrate a block of codeDemonstrate a block of code
5.If BranchingIf Branching
6.If ElseIf Else
7.Another if elseAnother if else
8.Illustrates the use of the if statementIllustrates the use of the if statement
9.Illustrates the use of an if statement that executes a blockIllustrates the use of an if statement that executes a block
10.illustrates the use of a nested if statementillustrates the use of a nested if statement
11.Logical operators with an if statementLogical operators with an if statement