Monday 26 August 2013

Best tutorial learning C# Programming

Que:- you can use any valid Boolean expression for the condition. You can use logical operators such as &&, &, ||, | and ! to make compound conditions. The following code shows examples???


A


Ans:- using System;
using System.Collections.Generic;
using System.Text;

namespace codeforevenorodd
{
    class Program
    {
        static void Main(string[] args)
        {
          bool result=true;
          if (!result)
          {
              Console.WriteLine("false");
          }
          else
          {
              Console.WriteLine("true");
          }
            //and
          int m = 9;
          int n = 7;
          int p = 5;
          if (m > n && m > p)
          {
              Console.WriteLine("m is greater than n and p");
          }
          if (m > n && !(p > m))
          {
              Console.WriteLine("m is greater than n and p");
          }
          if (m > n || m > p)
          {
              Console.WriteLine("greater");
          }
          m = 4;
          if (!(m >= n || m >= p))
          {
              Console.WriteLine("smaller");
          }
          Console.ReadKey();
          
        }
       
     

        }
      
        }
   
 

No comments:

Post a Comment