Skip to main content

Posts

Showing posts from 2018

C# Control Statements (if-else)

C# if-else In C# programming, the  if statement  is used to test the condition. There are various types of if statements in C#. if statement if-else statement nested if statement if-else-if ladder C# IF Statement The C# if statement tests the condition. It is executed if condition is true. Syntax: if (condition){   //code to be executed    }   C# If Example using System;       public   class  IfExample       {           public   static   void  Main(string[] args)           {                int  num =  10 ;                if  (num %  2 ...

C# Operators

An operator is used to perform some operation eithor mathematical or logical on operands. C# provides following Operators. Arithmetic Operators Relational Operators Logical Operators Assignment Operators Misc Operators 1.  Relational Operators Following  tables shows the operators and its working with examples. Operator Description Example == Checks if the values of two operands are equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (A != B) is true. >   Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. <   Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. ...