next


Hello World Program
Unary Operators

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome To Hello World");
            Console.Read();
        }
    }
}


OUTPUT: Welcome To Hello World

UnaryMinus

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("the sign value is"+(-x));
            Console.Read();
        }
    }
}

PreIncrement Operator(++x)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("PreIncrement is"+(++x));
            Console.Read();
        }
    }
}


PostIncrement Operator(x++)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("PostIncrement is"+(++x));
            Console.Read();
        }
    }
}

PreDecrement Operator(- -x)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("PreDecrement is"+(--x));
            Console.Read();
        }
    }
}


PostDecrement Operator(x- -)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("PostDecrement is"+(x--));
            Console.Read();
        }
    }
}

Addition Of Two numbers
Binary Operators

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y, z;
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x + y;
            Console.WriteLine("addtion is"+z);
            Console.Read();
        }
    }
}

Swapping Of Two Numbers
Assignment Operators


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("x values is" + x + "y value is" + y);
            z = x;
            x = y;
            y = z;
            Console.WriteLine("x values is"+x + "y value is"+y);
            Console.Read();
        }
    }
}

Swapping Of Two Numbers Without Using Third Variable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y;
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("x values is" + x + "y value is" + y);
            x = x + y;
            y = x - y;
            x = x - y;
            Console.WriteLine("x values is"+x + "y value is"+y);
            Console.Read();
        }
    }
}

Relational Operators Without Using Third Variable
Relational Operators

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y;
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
      
            Console.WriteLine(x>y);
            Console.Read();
        }
    }
}

Relational Operators With Using Third Variable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y;
            bool z;
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = (x > y);
            Console.WriteLine(z);
            Console.Read();
        }
    }
}

 

Logiccal Operators Without Using Third Variable
Logical Operators

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            Console.WriteLine("enter x ,y ,z value");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
	    z = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(x>y && x>z);
            Console.Read();
        }
    }
}

Logiccal Operators With Using Third Variable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            Console.WriteLine("enter x ,y ,z values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
	    z = Convert.ToInt32(Console.ReadLine());
		bool p=(x>y && x>z);
            Console.WriteLine(p);
            Console.Read();
        }
    }
}

Bitwise AND Operator
Bitwise Operators

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x & y;
            Console.WriteLine("Bitwise AND Value is "+z);
            Console.Read();
        }
    }
}

Bitwise OR Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x | y;
            Console.WriteLine("Bitwise OR Value is "+z);
            Console.Read();
        }
    }
}

Bitwise ^(CAP) Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x ^ y;
            Console.WriteLine("Bitwise CAP Value is "+z);
            Console.Read();
        }
    }
}

Bitwise Nagetion(~) Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x,z;
            
            Console.WriteLine("enter x  value");
            x = Convert.ToInt32(Console.ReadLine());
            z = ~x 
            Console.WriteLine("Bitwise Nagetion Value is "+z);
            Console.Read();
        }
    }
}

Bitwise Left Shift Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x << y;
            Console.WriteLine("Bitwise Left Shift Value is "+z);
            Console.Read();
        }
    }
}

Bitwise Right Shift Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y,z;
            
            Console.WriteLine("enter x ,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());
            z = x >> y;
            Console.WriteLine("Bitwise Right Shift Value is "+z);
            Console.Read();
        }
    }
}

Max Number Program Using Ternary Operator
Ternary Operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int x,y;
            Console.WriteLine("enter x,y value");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());

            string s=   x>y ? "x is max ": "y is max";

            Console.WriteLine(s);
            Console.Read();
        }
    }
}

ODD or Even Number Program Using Ternary Operator

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());
            string s=   x % 2 == 0 ? "even" : "odd";

            Console.WriteLine(s);
            Console.Read();
        }
    }
}

ODD or Even Number Program Using IF ELSE Condition
Conditional

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            Console.WriteLine("enter x value");
            x = Convert.ToInt32(Console.ReadLine());


            if (x % 2 == 0)
            {
                Console.WriteLine("even");
            }
            else
            {
                Console.WriteLine("odd");
            }

      
         Console.Read();
        }
    }
}

Max Number Program Using IF ELSE Condition

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int x,y;
            Console.WriteLine("enter x,y values");
            x = Convert.ToInt32(Console.ReadLine());
            y = Convert.ToInt32(Console.ReadLine());


            if (x > y)
            {
                Console.WriteLine("X is Max");
            }
            else
            {
                Console.WriteLine("Y is Max");
            }

      
         Console.Read();
        }
    }
}

Vowel & Consonant Program Using IF ELSE Condition

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
      		char ch;
  			Console.WriteLine("enter Character");
            ch=Convert.ToChar(Console.ReadLine());
 			if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
    		{
            Console.WriteLine("Vowel");
            }
            else
            {
            Console.WriteLine("Consonant");
            }
       }
    
    }
 }