आज हम C programming language सिखने की इस सीरीज what is Relational Operators in C in Hindi और types of Relational Operators in C Hindi | कितने प्रकार के होते हैं? के बारे में पढ़ेंगे। friends Hindi me IT में आपका बहुत बहुत अभिनान्दन हैं.
what are Relational Operators in C in Hindi | C programming में Relational Operators का क्या काम हैं?
Relational Operators का use C प्रोग्रामिंग लैंग्वेज में दो Operands के बीच comparison करने के लिए किया जाता हैं। यानी की इनको हम comparison Operators भी कह सकते हैं। यानी की हम दो Operands में ये चेक करते हैं कौन-सा Operand छोटा, बड़ा, या Operands बराबर हैं।
जब दो Operands की value के बीच Compare करते हैं। तो हमे दो Condition मिलती हैं पहली तो अगर comparison सही होता हैं तो true retun होता हैं। और comparison गलत होता हैं तो false return होता हैं।
Operands के Compare करने पर हमको जो true या false मिलता हैं उसके अनुसार ही हम अपने प्रोग्राम में लॉजिक लिखते हैं। तो चलिए Relational Operators कितने प्रकार के होते हैं C प्रोग्रामिंग लैंग्वेज में उनके बारे में जानते हैं।
types of Relational operators in C in Hindi
C प्रोग्रामिंग लैंग्वेज में Relational Operators मुख्य रूप से 6 प्रकार के होते हैं।
- Equal Equal to operator (==)
- Not equal to operator (!=)
- Greater than operator (>)
- Less than operator (<)
- Greater than or equal to operator (>=)
- Less than or equal to operator (<=)
S.No. | Operator | Name | Description |
1. | == | Equal Equal to operator | दो operands की वैल्यू बराबर होती हैं तो ture मिलता हैं नहीं तो false मिलता हैं। |
2. | != | Not Equal to | दो operands की वैल्यू बराबर होती हैं तो false मिलता हैं। नहीं तो true मिलता हैं। |
3. | < | Less Than | दो operands की वैल्यू में पहले operand की वैल्यू दूसरे से छोटी होती हैं तो true मिलता हैं। नहीं तो false मिलता हैं। |
4. | > | Greater Than | दो operands की वैल्यू में पहले operand की वैल्यू दूसरे से बड़ी होती हैं तो true मिलता हैं। नहीं तो false मिलता हैं। |
5. | >= | Greater than or equal to | दो operands की वैल्यू में पहले operand की वैल्यू दूसरे से बड़ी या होती हैं तो true मिलता हैं। नहीं तो false मिलता हैं। |
6. | <= | Less than or equal to | दो operands की वैल्यू में पहले operand की वैल्यू दूसरे से छोटी या बराबर होती हैं तो true मिलता हैं। नहीं तो false मिलता हैं। |
कुछ example इस प्रकार हैं।
- what are operators in C in Hindi|types of operators in Hindi
- what are Identifiers in C in Hindi? | Identifiers क्या हैं? 2022
S.No | Expression | Output |
1. | 6>5 | true |
2. | 6<=5 | false |
3. | 5>5 | false |
4. | 5>=5 | true |
5. | 5!=18 | true |
6. | 5!=5 | false |
7. | 5==6 | false |
8. | 5==5 | true |
9 | 5<6 | true |
10. | 5>=6 | false |
11. | 5<=5 | true |
12. | 6<5 | false |
1. Equal Equal to operator (==) in C in hindi
Equal Equal to operator दो Operands के बीच ये comparison करता हैं की दोनों Operands की value बराबर हैं की नहीं अगर बराबर होती हैं तो true retun करता हैं अगर दोनों Operands बराबर नहीं होते हैं तो false retun करता हैं।
इस एक example के जरिये समझते हैं।
#include <stdio.h> int main() { int x=10,y=5; if(x==y) { printf("\nBoth Are Equal"); } else { printf("\nBoth Are Not Equal"); } return 0; }
Output
Both Are Equal
ऊपर दिए गए example में हमने दो Operands लिए हैं। x और y दोनों की वैल्यू 10 हैं। उसे बाद हमने if कंडशन के अंदर दोनों Operands को check किया Equal to Equal operator की हेल्प से दोनों की value बराबर हैं इसलिए कंडीशन true होगी उसके बाद कम्पाइलर if के अंदर जायेगा और उसके अंदर लिखी सभी स्टेटमेंट को exute कर देगा।
और हमे output में Both Are Equal प्राप्त होगा।
Example 2
#include <stdio.h> int main() { int x,y; if(x==y) { printf("\nBoth Are Equal"); } else { printf("\nBoth Are Not Equal"); } return 0; }
Output
Both Are Not Equal
ऊपर दिए गए example 2 में हमने दो Operands लिए हैं। x और y, x की वैल्यू 10 हैं और y की वैल्यू 5 । उसे बाद हमने if कंडशन के अंदर दोनों Operands को check किया Equal to Equal operator की हेल्प से दोनों की value नहीं बराबर हैं इसलिए कंडीशन false होगी उसके बाद कम्पाइलर if के नहीं अंदर जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में Both Are Not Equal प्राप्त होगा।
2. Not equal to operator (!=) in C in Hindi
not Equal to operator दो Operands के बीच ये comparison करता हैं की दोनों Operands की value बराबर हैं की नहीं अगर बराबर होती हैं तो false retun करता हैं अगर दोनों Operands बराबर नहीं होते हैं तो true retun करता हैं। यह Equal to Equal to operator के विपरीत होता हैं।
Example 1
#include <stdio.h> int main() { int x=10,y=5; if(x!=y) { printf("\nBoth Are not Equal"); } else { printf("\nBoth Are Equal"); } return 0; }
Output -:
Both Are not Equal
output में हमको Both Are not Equal मैसेज क्यों मिल रहा हैं। क्योकिं इस example में हमने दो Operands हैं x और y , x = 10 हैं और y की वैल्यू 5 हैं उसके बाद if कंडीशन में चेक कर रहे हैं की क्या x y के Equal नहीं हैं। सही बात हैं x y के Equal नहीं हैं क्योकिं x वैल्यू 10 और y की 5 हैं। इसलिए कंडीशन true होती हैं। और कम्पाइलर if कंडीशन के अंदर जाने के बाद if की सभी स्टेटमेंट exute कर देता हैं।
इसलिए हमें output में Both Are not Equal मिलता हैं।
Example 2
#include <stdio.h> int main() { int x=10,y=10 ; if(x!=y) { printf("\nBoth Are not Equal"); } else { printf("\nBoth Are Equal"); } return 0; }
Output -:
Both Are Equal
output में हमको Both Are Equal मैसेज क्यों मिल रहा हैं। क्योकिं इस example में हमने दो Operands हैं x और y दोनों की वैल्यू 10 हैं। उसके बाद if कंडीशन में चेक कर रहे हैं की क्या x y के Equal नहीं हैं। जबकि x y के Equal हैं ये गलत गलत हैं। x y के Equal हैं क्योकिं x वैल्यू 10 और y की भी वैल्यू 10 हैं। इसलिए कंडीशन false होती हैं। और कम्पाइलर if कंडीशन के अंदर नहीं जाता हैं। और else पार्ट को exute कर देता हैं।
इसलिए हमें output में Both Are Equal मिलता हैं।
3. Greater than operator (>) in C in Hindi
Greater than operator (>) का काम C programming लैंग्वेज में दो Operands को चेक करता हैं की पहला Operand दूसरे Operand से बड़ा है या नहीं। अगर पहला Operand दूसरे Operand बड़ा होता हैं तो true मिलता हैं अगर बराबर या छोटा होता हैं तो false मिलता हैं।
- Constants in C Hindi |const keyword in C in Hindi 2022
- what is Increment and Decrement Operator in Hindi |2022
Example 1
#include <stdio.h> int main() { int x=10,y=5 ; if(x > y) { printf("\n x is Greater than y "); } else { printf("\n x is smaller than y"); } return 0; }
Output -:
x is Greater than y
इस Example में हम Greater than operator (>) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा हैं। इस Example में x की वैल्यू 10 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा हैं। x y से बड़ा ही हैं इसलिए कंडीशन होगी true और कम्पाइलर if कंडीशन के अंदर जायेगा और if के अंदर सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than y मिलेगा।
Example 2
#include <stdio.h> int main() { int x=5,y=6 ; if(x > y) { printf("\n x is Greater than y "); } else { printf("\n x is smaller than y"); } return 0; }
Output -:
x is smaller than y
इस Example में हम Greater than operator (>) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 6 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा हैं। x y से बड़ा नहीं हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than y मिलेगा।
Example 3
#include <stdio.h> int main() { int x=5,y=5; if(x > y) { printf("\n x is Greater than y "); } else { printf("\n x is smaller than y"); } return 0; }
Output -:
x is smaller than y
इस Example में हम Greater than operator (>) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा हैं। x y से बड़ा नहीं हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than y मिलेगा।
4. Less than operator (<) in C in Hindi
Less than operator (<) का काम C programming लैंग्वेज में दो Operands को चेक करता हैं की पहला Operand दूसरे Operand से छोटा है या नहीं। अगर पहला Operand दूसरे Operand छोटा होता हैं तो true मिलता हैं अगर बराबर या बड़ा होता हैं तो false मिलता हैं।
Example 1
#include <stdio.h> int main() { int x=4 ,y=5 ; if(x < y) { printf("\n x is smaller than y "); } else { printf("\n x is Greater than y"); } return 0; }
Output -:
x is smaller than y
इस Example में हम Greater than operator (<) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा हैं। इस Example में x की वैल्यू 4 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा हैं। x y से छोटा ही हैं इसलिए कंडीशन होगी true और कम्पाइलर if कंडीशन के अंदर जायेगा और if के अंदर सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is smaller than y मिलेगा।
Example 2
#include <stdio.h> int main() { int x=6,y=5 ; if(x > y) { printf("\n x is smaller than y "); } else { printf("\n x is Greater than y"); } return 0; }
Output -:
x is Greater than y
इस Example में हम Greater than operator (>) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा हैं। इस Example में x की वैल्यू 6 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा हैं। x y से छोटा नहीं हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
- Decision making in C | nested if statement in C in Hindi 2022
- Control Statement in C | Switch Statement in C in Hindi 2022
और हमे output में x is Greater than y मिलेगा।
Example 3
#include <stdio.h> int main() { int x=5,y=5; if(x > y) { printf("\n x is smaller than y "); } else { printf("\n x is Greater than B"); } return 0; }
Output -:
x is Greater than B
इस Example में हम Greater than operator (>) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा हैं। x y से छोटा नहीं हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than y मिलेगा।
5. Greater than or equal to operator (>=) in C Hindi
Greater than or equal to operator (>=) का काम C programming लैंग्वेज में दो Operands को चेक करता हैं की पहला Operand दूसरे Operand से बड़ा या equal है या नहीं। अगर पहला Operand दूसरे Operand बड़ा या equal होता हैं तो true मिलता हैं अगर छोटा होता हैं तो false मिलता हैं।
Example 1
#include <stdio.h> int main() { int x=10,y=5 ; if(x >= y) { printf("\n x is Greater than or Equal to y "); } else { printf("\n x is not Greater than or Equal to y"); } return 0; }
Output -:
x is Greater than or Equal to y
Greater than or equal to operator (>=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा या बराबर हैं। इस Example में x की वैल्यू 10 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा या बराबर हैं। x y से बड़ा ही हैं इसलिए कंडीशन होगी true और कम्पाइलर if कंडीशन के अंदर जायेगा और if के अंदर सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than or Equal to y मिलेगा।
Example 2
#include <stdio.h> int main() { int x=5,y=6 ; if(x >= y) { printf("\n x is Greater than or Equal to y "); } else { printf("\n x is not Greater than or Equal to y "); } return 0; }
Output -:
x is not Greater than or Equal to y
Greater than or equal to operator (>=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा या बराबर हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 6 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा या बराबर हैं। x y से बड़ा नहीं हैं और न ही बराबर हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में x is not Greater than or Equal to y मिलेगा।
Example 3
#include <stdio.h> int main() { int x=5,y=5; if(x >= y) { printf("\n x is Greater than or Equal to y "); } else { printf("\n x is not Greater than or Equal to y "); } return 0; }
Output -:
x is Greater than or Equal to y
इस Example में हम Greater than Equal to operator (>=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से बड़ा या बराबर हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से बड़ा या बराबर हैं। x y से बड़ा लेकिन बराबर हैं। इसलिए कंडीशन होगी True जाएगी और कम्पाइलर if कंडीशन के अंदर जायेगा और सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is Greater than or Equal to y मिलेगा।
6. Less than or equal to operator (<=) in Hindi
Less than or equal to operator (<=) का काम C programming लैंग्वेज में दो Operands को चेक करता हैं की पहला Operand दूसरे Operand से छोटा या equal है या नहीं। अगर पहला Operand दूसरे Operand छोटा या equal होता हैं तो true मिलता हैं अगर बड़ा होता हैं तो false मिलता हैं।
Example 1
#include <stdio.h> int main() { int x=4 ,y=5 ; if(x <= y) { printf("\n x is Less Than Or Equal to y "); } else { printf("\n x is not Less Than Or Equal to y"); } return 0; }
Output -:
x is Less Than Or Equal to y
Less than or equal to operator (<=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा या बराबर हैं। इस Example में x की वैल्यू 4 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा या बराबर हैं। x y से छोटा ही हैं इसलिए कंडीशन होगी true और कम्पाइलर if कंडीशन के अंदर जायेगा और if के अंदर सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is Less Than Or Equal to y मिलेगा।
Example 2
#include <stdio.h> int main() { int x=5,y=4 ; if(x <= y) { printf("\n x is is Less Than Or Equal to y "); } else { printf("\n x is not Less Than Or Equal to y "); } return 0; }
Output -:
x is not Less Than Or Equal to y
Less than or equal to operator (<=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा या बराबर हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 4 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा या बराबर हैं। x y से छोटा नहीं हैं और न ही बराबर हैं इसलिए कंडीशन होगी false जाएगी और कम्पाइलर if कंडीशन के अंदर नहीं जायेगा और else स्टेटमेंट को exute कर देगा।
और हमे output में x is not Less Than Or Equal to y में मिलेगा।
Example 3
#include <stdio.h> int main() { int x=5,y=5; if(x <= y) { printf("\n x is is Less Than Or Equal to y "); } else { printf("\n x is not Less Than Or Equal to y "); } return 0; }
Output -:
x is is Less Than Or Equal to y
इस Example में हम Less than Equal to operator (<=) हेल्प से ये जानने की कोशिश कर रहे हैं क्या x y से छोटा या बराबर हैं। इस Example में x की वैल्यू 5 और y की वैल्यू 5 हैं। अब if स्टेटमेंट में हम चेक कर रहे हैं क्या x y से छोटा या बराबर हैं। x y से छोटा लेकिन बराबर हैं। इसलिए कंडीशन होगी True जाएगी और कम्पाइलर if कंडीशन के अंदर जायेगा और सभी स्टेटमेंट को exute कर देगा।
और हमे output में x is is Less Than Or Equal to y मिलेगा।
By reference :- https://www.javatpoint.com/relational-operator-in-c
Conclusion
इस आर्टिल्स में हमने सीखा what is Relational Operators in C in Hindi और types of Relational Operators in C Hindi | कितने प्रकार के होते हैं?
दोस्तों मैं आशा करता हूँ कि आपको ये जानकारी पसंद आयी होगी और यदि ये जानकारी आपको पसंद आयी हो तो इस जानकारी को अपने दोस्तों के साथ शेयर करे ताकि उनको भी what is Relational Operators in C in Hindi और types of Relational Operators in C Hindi | कितने प्रकार के होते हैं? को जानने हेल्प मिलेगी।
अगर आपको अभी भी what is Relational Operators in C in Hindi और types of Relational Operators in C Hindi | कितने प्रकार के होते हैं? | कितने प्रकार के होते हैं? से संबंधित कोई भी प्रश्न या Doubt है तो आप कमेंट्स के जरिए हमसे पुछ सकते है। मैं आपके व्दारा पूछा गये सभी सवालों का जवाब दूँगा।
अगर आपको हमारे व्दारा दी जानकारी पसंद आती हैं और आप ,Computer Science, इंटरनेट, IT, मॉडल टेक्नोलॉजी और new जानकारी पढ़ना अच्छा लगता हैं. तो आप हमारे इस ब्लॉग को जरूर सब्सक्राइब कर कर लो | अगर आपका हमको कोई नया सुझाब देना हैं तो वह भी बताये।
FAQ प्रश्न
C programming में Relational Operators का क्या काम हैं?
Relational Operators का use C प्रोग्रामिंग लैंग्वेज में दो Operands के बीच comparison करने के लिए किया जाता हैं। यानी की इनको हम comparison Operators भी कह सकते हैं। यानी की हम दो Operands में ये चेक करते हैं कौन-सा Operand छोटा, बड़ा, या Operands बराबर हैं।
what are Relational Operators in C programmng language in Hindi
जब दो Operands की value के बीच Compare करते हैं। तो हमे दो Condition मिलती हैं पहली तो अगर comparison सही होता हैं तो true retun होता हैं। और comparison गलत होता हैं तो false return होता हैं।