Sunday, June 22, 2014

C# Tutorial for Beginners 5 - If-Statement with Comparison Operators and...









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
namespace MyProject.Examples
{
    class ExampleOne
    {
        static void Main()
        {
            int num1, num2;            
            //Accepting Values from users
            Console.Write("Enter first number\t\t");
            num1 = Convert.ToInt32(Console.ReadLine());

            Console.Write("\n\nEnter second number\t\t");
            num2 = Convert.ToInt32(Console.ReadLine());

            if(num1<num2 || num1==20)
            {
                Console.Write("num1 is less then num2 or num 1 is 20\t\t");
            }
            else if (num1 == num2)
            {
                Console.Write("num1 is = num2\t\t");
            }
            else
            {
                Console.Write("num1 is gererat then num2\t\t");
            }
  
            Console.ReadKey();
        }
    }
}


















-----------------------------------------------

Searches related to c# if statement

c# if statement shorthand

c# if statement multiple conditions

c# if statement string

c# if statement one line

c# if statement or operator

c# if statement not equal

nested if statement c#

c# assignment in if statement

Searches related to c# Comparison Operators

c# comparison operators enum

relational operators

equality comparison

operators equality

c# logical operator

c# string comparison operators

c# override comparison operator

Searches related to c# Logical Operator

c# logical operator precedence

c# logical operator short circuit

c# boolean operators

c# logical xor operator

.net & operator

c# not operator

visual c# operators

c# short circuit

c# logical operators precedence

No comments:

Post a Comment