Comparison Operators in c# In Hindi

Comparison Operators in c# In Hindi

C# प्रोग्रामिंग लैंग्वेज में कम्पेरिजन ऑपरेटर्स का यूज़ दो डिफरेंट यूजर डिफाइन डाटा टाइप प्रोग्राम पैरामीटर वेरिएबल वैल्यूज़ को आपस में कम्पेयर करने में किया जाता है, जो की दो दी गई इंडिविजुअल प्रोग्राम डाटा टाइप वैल्यू कम्पेरिजन के आधार पर एक बूलियन रिज़ल्ट आउटपुट जैसे (true या false) के रूप में रिजल्ट को प्रोवाइड करता है। C# प्रोग्राम में कम्पेरिजन ऑपरेटर्स का यूज़ कंडीशनल फ्लो स्टेटमेंट्स जिसमे (if, while, आदि) ऑपरेटर में डिसीजन को प्रोडूस करने में किया जाता है। C# प्रोग्रामर कम्पेरिजन ऑपरेटर्स का यूज़ मल्टीप्ल वैल्यू कम्पेरिजन या टेस्टिंग जीसमे ==,! =, >, <, >=, <=, आदि ऑपरेटर के बेस पर मल्टीप्ल कंडीशन और एक्सप्रेशन को टेस्ट या एनालाइज कर सकते है.

Comparison Operators in c# In Hindi

List of popular Comparison Operators in c#.

OperatorComparison operator DescriptionExampleOutput
==Equal to Comparison operator used to check Comparison between two different variable valuesp == qOutput is true if p equals q value
!=Not equal to operator used to check not equality between two separate variablesp! = qOutput is true if p does not equal q variable value
Greater than Comparison operator used to check greater than value between two variablesp > qOutput is true if p is greater than q variable value
Less than Comparison operator used to check variable value is lessp < qOutput is true if p is less than q value
>=Greater than or equal to operator used to check given variable value is greater than or equal top >= qOutput is true if p is greater than or equal to q value
<=Less than or equal to operator used to check given variable value is less than or equal top <= qOutput is true if p is less than or equal to q value

Example of a comparison operator in C#.

using System;

class ComparisonOperators

{

    static void Main()

    {

        int p = 7;

        int q = 2;

        Console.WriteLine($”to check the equality of p == q – { p == q }”);   // Result is – False

        Console.WriteLine($”to check the not equality of p != q – {p != q}”);   // Result is – True

        Console.WriteLine($”to check the greater than value is p > q – { p > q}”);     // Result is – True

        Console.WriteLine($”to check the less than value is p < q – { p < q}”);     // Result is – False

        Console.WriteLine($”to check the value is Greater than or equal to value p >= q – { p >= q }”);   // Result is – True

        Console.WriteLine($”to check the value is Less than or equal to value  p <= q – { p <= q }”);   // Result is – False

    }

}

Important elements of C# comparison operators.

C# प्रोग्रामिंग लैंग्वेज में इक्वालिटी चेक ऑपरेटर (==) वर्सेज असाइनमेंट (=) दोनों का यूज़ अलग अलग पर्पस के लिए C# प्रोग्राम में किया जाता है. जहा इक्वलिटी ऑपरेटर दो वैल्यू को आपस में कम्पेयर करता है, वही असाइनमेंट ऑपरेटर एक यूजर डिफाइन वेरिएबल को वैल्यू असाइन करता है.

Elements of C# comparison operators.

  • == यूजर डिफाइन प्रोग्राम में दो वेरिएबल वैल्यूज़ को आपस में कम्पेयर करता है।
  • = यूजर डिफाइन प्रोग्राम में वेरिएबल को एक वैल्यू असाइन करता है।

int p = 4; // p वेरिएबल वैल्यू असाइनमेंट

bool isEqual = (p == 4); // p वेरिएबल वैल्यू इक्वालिटी चेक, true

using System;

class AssignmentOperator

{

    static void Main()

    {

        int p = 7;                 // here it Assign value to p variable

        bool isEqual = (p == 7);  // here it Equality to check, true

        Console.WriteLine(“the Value of p variable – ” + p);

        Console.WriteLine(“Is the p variable is equal to 7? ” + isEqual);

    }

}

Comparing strings in the C# programming language.

C# प्रोग्रामिंग लैंग्वेज में केस सेंसिटिविटी प्रॉब्लम को अवॉयड करने के लिए दो अलग अलग स्ट्रिंग्स टेक्स्ट वैल्यू को कम्पेयर करने के लिए Equals() फंक्शन मेथड का यूज़ किया है.

using System;

class Program

{

    static void Main()

    {

        string text1 = “Vcanhelpsu”;

        string text2 = “vcanhelpsu”;

        bool output = text1.Equals(text2, StringComparison.OrdinalIgnoreCase);

        Console.WriteLine(“the String 1 text is – ” + text1);

        Console.WriteLine(“the String 2 text is – ” + text2);

        Console.WriteLine(“Are they really equal text or case-insensitive ? ” + output);

    }

}

Comparison for floating-point type values ​​in the C# programming language.

C# प्रोग्रामिंग लैंग्वेज में डिटेल एग्जैक्ट प्रिसिएशन आउटपुट वैल्यू इशूज़ से होने वाले प्रॉब्लम के कारण फ्लोटिंग-पॉइंट डाटा टाइप वेरिएबल वैल्यू नंबर्स को डायरेक्ट किसी भी  प्रोग्राम में कम्पेरिजन से बचें।

double p = 0.3 + 0.7;

Console.WriteLine(Math.Abs(x – 0.10) < 0.11); // True

Example of floating-point type values Comparison.

using System;

class FloatingPoint

{

    static void Main()

    {

        double p = 0.3 + 0.4;

        // here it Check if p variable value is approximately equal to 0.7

        bool isEqual = Math.Abs(p – 0.7) < 0.8;

        Console.WriteLine(“the Value of p floating number is – ” + p);

        Console.WriteLine(“Is p variable approximately equal to 0.7? ” + isEqual);

    }

}

Leave a Reply