हिंदी माध्यम नोट्स
Categories: C Language in hindi
operators in c language in hindi , ऑपरेटर्स इन c कंप्यूटर भाषा में हिंदी में , ऑपरेटर in c लैंग्वेज
बेसिक ऑपरेटर्स इन c कंप्यूटर भाषा में हिंदी में , ऑपरेटर in c लैंग्वेज operators in c language in hindi :-
C language मे कई सारी operators को support करता है | इस operator को प्रोग्रामर airthmatic और logical कैलकुलेशन के ल;इए use कर सकते है| Operator जिन data और variable पर use होता है उसे oprand कहते है |
C language मे आठ प्रकार के operator होते है |
1.Airthmatic operator
2.Relational operator
3.Logoical operator
4.Assignment Operator
5.Increment or Decreament Operator
6.Conditional operator
7.Bitwise Operator
8.Special Operator . Airthmatic Operator :
C LANGUAGE मे पांच BASIC OPERATOR को support करता है|जिनकी लिस्ट नीचे है|
C language मे आठ प्रकार के operator होते है |
1.Airthmatic operator
2.Relational operator
3.Logoical operator
4.Assignment Operator
5.Increment or Decreament Operator
6.Conditional operator
7.Bitwise Operator
8.Special Operator . Airthmatic Operator :
C LANGUAGE मे पांच BASIC OPERATOR को support करता है|जिनकी लिस्ट नीचे है|
S.No | Operator | Use |
1 | Addition ( + ) | Add input |
2 | Subtraction (-) | Subtract inputs |
3 | Mutiplication ( *) | Multiply two digit |
4 | Divide ( / ) | Divide two digits |
5 | Modulas (%) | Find a reminder |
#include <conio.h>
Void main ()
{
Int a,b,c,d;
Float e,f,g;
Printf(“Enter your first number=”);
Scanf(“%d”,&a);
Printf(“Enter your second number=”);
Scanf(“%d”,&b);
c=a+b;
d=a-b;
e=a*b;
f=a/b;
g=a%b;
printf(“Sum of inputs = %d”,c);
printf(“Difference of
inputs = %d”,d);
inputs = %d”,d);
printf(“Multiplication of inputs=%f”,e);
printf(“Divided of inputs=%f”,f);
printf(“Remainder of input%f”,g);
}
इस उदाहरण मे सभी arithmetic operation को perform किया गया है | इस उदहारण का आउटपुट ये है |
Enter your input=128
Enter your input=2
sum of inputs=130
Difference of inputs=126
Multiplication of inputs=256
Divided of inputs=64
Remainder of inputs=0
Relational Operators:
Relational operators ये operators होते है दो या दो अधिक से data के बीच comparsion करते है |जैसे अगर दो person या उनके age को compare करना होता है तो relational operator का use होगा|ये expression जिनमे relation operator useहोते है उसे relational expression कहते है | C Language मे six relational operators होते है |
S.No | Operator | Use |
1 | Less Than ( < ) | When a is less than b |
2 | Less than or equal than ( <= ) | When a is less than or equal than b |
3 | Greater than ( > ) | When a is greater than b |
4 | Greater than or equal than ( >= ) | When a is greater than or equal than b |
5 | Equal Than (==) | When a is equal than b |
6 | Not Equal Than (!=) | When a is not equal than b |
उदहारण :
#include <conio.h>
Void main ()
{
Int a,b;
Printf(“Enter your first number”);
Scanf(“%d”,&a);
Printf(“Enter your second number”);
Scanf(“%d”,&b);
If (a==b)
{
Printf(“a is equal than b .”);
}
Printf(“a is not equal b”);
}
इस उदहारण मे दो values को compare किया जा रहा है |जब ये सामान होगे तो a is equal than b का message print होगा | नहीं है तो a is not equal b.
आउटपुट:
Enter your input=167
Enter your inpuit=167
a is equal than b .
Logical Operator :
जब दो या दो अधिक condition को check करना होता है तब इस operator का use होता है |ये expression जो दो या दो अधिक relation expression रखते है उन्हें लॉजिकल expression कहते है |C language मे तीन लॉजिकल ऑपरेटर होते है|
AND (&&) :
जब सभी conditions true होगी तब expression का रिजल्ट true होगा |जैसे
if (a==1 && b==2)
{
printf (“Print Logical Expression Message “) ;
}
इस उदाहरण मे Print Logical Expression Message print तभी होगा जब a की value1 और b की value 2 होगी |
OR(||)
जब कोई एक conditions true होने पर expression का रिजल्ट true मिलेगे |जैसे
if (a==1 || b==2)
{
printf (“Print Logical Expression Message “) ;
}
इस उदाहरण मे Print Logical Expression Message print तभी होगा जब a की value 1 या b की value 2 होगी |
NOT(!)
ये लॉजिकल ऑपरेटर किसी relation expression को उल्टा करने के लिए use होता है |
जैसे
if !(a==b)
{
printf(” a is equal b “);
}
else
{
printf (“a is not equal b”);
}
इस उदहारण मे not operator होने पर a==b उल्टा काम करगे |मतलब अगर a और b equal होगा तब a is not equal b print होगा |
Assignment Operator :
Assignment Operator का use किसी expression के result किसी variable मे assign करने के किया जाता है |Assignment operator के अलावा shorthand Assignment operator भी होता है |
जब कभी किसी expression के result को उस expression मे उस operand मे assign करना होता है तब shorthand Assignment operator का यूज़ कर सकते है |
जैसे
a=a+b; //Assignment operator
a+=b; //shorthand Assignment operator
shorthand Assignment operator का syntax नीचे है =:
variable operators = expression;
उदहारण :
a=a+1; a+=1;
a=a-1; a-=1;
a=a/(n+1) a/=(n+1)
a=a%(n-1) a%=(n-1)
Increment Or Decreament operator :
C language मे सबसे ज्यादा इस्तेमाल होने वाला operator है ये दोनों |ये Unary operator है इसका अर्थ है की ये किसी एक operand के साथ भी use हो सकते है |इसका सबसे ज्यादा इस्तेमाल looping (discuss in next article ) मे होता है | इनके syntax है |
++ और —
a++ ; is equivalent a=a+1;
a– ; is equivalent a=a-1;
ये दो तरह से इस्तेमाल हो सकते है (i) Pre or (ii) Post
Pre : इसमें a की value मे पहले increment/decrement होता है और बाद मे a की value को लूप मे इस्तेमाल होता है | इसका syntax है |
++a;
–a ;
Post :इसमें a की value मे लूप के एक बार’चलने के बाद increment/decrement होती है| इसका syntax है |
a++;
a–;
Conditional Operator :
ये tinary operator है |इसका मतलब है ये तीन operand पर कार्य कर सकता है |ये किसी भी condition को check करके दो आउटपुट देता है (i) true (ii)false| इसका syntax है |
condition expression ? statement1 : statement2 ;
उदहारण के लिए :
#include <conio.h>
main ()
{
Int a,b;
Printf(“Enter your first number=”);
Scanf(“%d”,&a);
Printf(“Enter your second number=”);
Scanf(“%d”,&b);
(a==b) ? printf(“a is equal b.”) : printf(“a is not equal b.”) ;
}
logic सामान है लेकिन प्रोग्राम को लिखने का space कम हो गया है |
आउटपुट होगा :
Enter your input=1456
Enter your input=456
a is not equal b.
इससे आगे article मे हम operator के कुछ एडवांस methodology को study करेगे|
Recent Posts
मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi
malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…
4 weeks ago
कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए
राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…
4 weeks ago
हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained
hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…
4 weeks ago
तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second
Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…
4 weeks ago
चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi
chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…
1 month ago
भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi
first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…
1 month ago